Skip to content

Commit

Permalink
Tests now work for version 93u+ 2012-08-01
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jun 4, 2013
1 parent 19f3d42 commit 36ad66c
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 104 deletions.
62 changes: 31 additions & 31 deletions configure.ac
Expand Up @@ -21,7 +21,7 @@ AC_SUBST(CMDLINE_INVOKED)
## --with-ksh can be used to tell the kshdb script and the regression
## test which ksh to run. It can be omitted too in which case we'll
## look for a ksh binary.
AC_ARG_WITH(POSIXSHELL, AC_HELP_STRING([--with-POSIXSHELL],
AC_ARG_WITH(POSIXSHELL, AC_HELP_STRING([--with-POSIXSHELL],
[location of POSIXSHELL program]), SH_PROG=$withval)

if test "$SH_PROG" = "yes" || test "$SH_PROG" = "no" || test -z "$SH_PROG"
Expand All @@ -35,9 +35,9 @@ if test "$SH_PROG" = no; then
fi

AC_MSG_CHECKING([Checking whether $SH_PROG is compatible with DEBUGGER])
if ! $SH_PROG -e '((.sh.version >= 20100309))' ; then
if ! $SH_PROG -e '((.sh.version >= 20120801))' ; then
ksh_version=$($SH_PROG -e 'print ${.sh.version}')
AC_MSG_RESULT([Need version later than 2010-03-09 and you have $ksh_version])
AC_MSG_RESULT([Need version later than 2012-08-01 and you have $ksh_version])
AC_MSG_ERROR([You might want to retry with another POSIXSHELL using the --with-POSIXSHELL option.])
else
AC_MSG_RESULT(yes!)
Expand All @@ -49,10 +49,10 @@ DIFF_OPTS=

if test "$DIFF" = no ; then
AC_PATH_PROG(DIFF, cmp, no)
else
else
dnl Try for GNU diff options.
# MSDOG output uses \r\n rather than \n in tests
for diff_opt in -w --unified -b ; do
for diff_opt in -w --unified -b ; do
if $DIFF $diff_opt $0 $0 > /dev/null 2>&1; then
AC_MSG_RESULT([adding $diff_opt to diff in regression tests])
DIFF_OPTS="$DIFF_OPTS $diff_opt"
Expand Down Expand Up @@ -90,66 +90,66 @@ AC_CONFIG_FILES([ \
])

AC_CONFIG_FILES(DEBUGGER, [chmod +x DEBUGGER])
AC_CONFIG_FILES([test/example/hanoi.sh],
AC_CONFIG_FILES([test/example/hanoi.sh],
[chmod +x test/example/hanoi.sh])

AC_CONFIG_FILES([test/integration/test-bug-args],
AC_CONFIG_FILES([test/integration/test-bug-args],
[chmod +x test/integration/test-bug-args])
AC_CONFIG_FILES([test/integration/test-break],
AC_CONFIG_FILES([test/integration/test-break],
[chmod +x test/integration/test-break])
AC_CONFIG_FILES([test/integration/test-bug-errexit],
AC_CONFIG_FILES([test/integration/test-bug-errexit],
[chmod +x test/integration/test-bug-errexit])
AC_CONFIG_FILES([test/integration/test-bugIFS],
AC_CONFIG_FILES([test/integration/test-bugIFS],
[chmod +x test/integration/test-bugIFS])
AC_CONFIG_FILES([test/integration/test-condition],
AC_CONFIG_FILES([test/integration/test-condition],
[chmod +x test/integration/test-condition])
AC_CONFIG_FILES([test/integration/test-delete],
AC_CONFIG_FILES([test/integration/test-delete],
[chmod +x test/integration/test-delete])
AC_CONFIG_FILES([test/integration/test-display],
AC_CONFIG_FILES([test/integration/test-display],
[chmod +x test/integration/test-display])
AC_CONFIG_FILES([test/integration/test-enable],
AC_CONFIG_FILES([test/integration/test-enable],
[chmod +x test/integration/test-enable])
AC_CONFIG_FILES([test/integration/test-examine],
AC_CONFIG_FILES([test/integration/test-examine],
[chmod +x test/integration/test-examine])
AC_CONFIG_FILES([test/integration/test-frame],
AC_CONFIG_FILES([test/integration/test-frame],
[chmod +x test/integration/test-frame])
AC_CONFIG_FILES([test/integration/test-list],
AC_CONFIG_FILES([test/integration/test-list],
[chmod +x test/integration/test-list])
AC_CONFIG_FILES([test/integration/test-next],
AC_CONFIG_FILES([test/integration/test-next],
[chmod +x test/integration/test-next])
AC_CONFIG_FILES([test/integration/test-restart],
AC_CONFIG_FILES([test/integration/test-restart],
[chmod +x test/integration/test-restart])
AC_CONFIG_FILES([test/integration/test-setshow],
AC_CONFIG_FILES([test/integration/test-setshow],
[chmod +x test/integration/test-setshow])
AC_CONFIG_FILES([test/integration/test-info-args],
[chmod +x test/integration/test-info-args])
AC_CONFIG_FILES([test/integration/test-skip],
AC_CONFIG_FILES([test/integration/test-skip],
[chmod +x test/integration/test-skip])
AC_CONFIG_FILES([test/integration/test-step],
AC_CONFIG_FILES([test/integration/test-step],
[chmod +x test/integration/test-step])
AC_CONFIG_FILES([test/integration/test-subshell1],
AC_CONFIG_FILES([test/integration/test-subshell1],
[chmod +x test/integration/test-subshell1])

AC_CONFIG_FILES([test/unit/test-alias.sh], [chmod +x test/unit/test-alias.sh])
AC_CONFIG_FILES([test/unit/test-break.sh],
AC_CONFIG_FILES([test/unit/test-break.sh],
[chmod +x test/unit/test-break.sh])
AC_CONFIG_FILES([test/unit/test-cmd-complete.sh],
AC_CONFIG_FILES([test/unit/test-cmd-complete.sh],
[chmod +x test/unit/test-cmd-complete.sh])
AC_CONFIG_FILES([test/unit/test-lib-complete.sh],
AC_CONFIG_FILES([test/unit/test-lib-complete.sh],
[chmod +x test/unit/test-lib-complete.sh])
AC_CONFIG_FILES([test/unit/test-columns.sh],
AC_CONFIG_FILES([test/unit/test-columns.sh],
[chmod +x test/unit/test-columns.sh])
AC_CONFIG_FILES([test/unit/test-dbg-opts.sh],
AC_CONFIG_FILES([test/unit/test-dbg-opts.sh],
[chmod +x test/unit/test-dbg-opts.sh])
AC_CONFIG_FILES([test/unit/test-eval.sh],
AC_CONFIG_FILES([test/unit/test-eval.sh],
[chmod +x test/unit/test-eval.sh])
AC_CONFIG_FILES([test/unit/test-examine.sh],
AC_CONFIG_FILES([test/unit/test-examine.sh],
[chmod +x test/unit/test-examine.sh])
AC_CONFIG_FILES([test/unit/test-file.sh],
[chmod +x test/unit/test-file.sh])
AC_CONFIG_FILES([test/unit/test-filecache.sh],
[chmod +x test/unit/test-filecache.sh])
AC_CONFIG_FILES([test/unit/test-get-sourceline.sh],
AC_CONFIG_FILES([test/unit/test-get-sourceline.sh],
[chmod +x test/unit/test-get-sourceline.sh])
AC_CONFIG_FILES([test/unit/test-fns.sh], [chmod +x test/unit/test-fns.sh])
AC_CONFIG_FILES([test/unit/test-frame.sh], [chmod +x test/unit/test-frame.sh])
Expand Down
31 changes: 17 additions & 14 deletions lib/filecache.sh
@@ -1,7 +1,7 @@
# -*- shell-script -*-
# filecache.sh - cache file information
#
# Copyright (C) 2008, 2009, 2010, 2011 Rocky Bernstein
# Copyright (C) 2008, 2009, 2010, 2011, 2013 Rocky Bernstein
# <rocky@gnu.org>
#
# This program is free software; you can redistribute it and/or
Expand All @@ -13,7 +13,7 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License along
# with this program; see the file COPYING. If not, write to the Free Software
# Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
Expand Down Expand Up @@ -49,7 +49,7 @@ _Dbg_filecache_reset() {
}
_Dbg_filecache_reset

# Check that line $2 is not greater than the number of lines in
# Check that line $2 is not greater than the number of lines in
# file $1
_Dbg_check_line() {
(( $# != 2 )) && return 1
Expand All @@ -62,7 +62,7 @@ _Dbg_check_line() {
return 1
fi

if (( line_number > max_line )) ; then
if (( line_number > max_line )) ; then
(( _Dbg_set_basename )) && filename=${filename##*/}
_Dbg_errmsg "Line $line_number is too large." \
"File $filename has only $max_line lines."
Expand All @@ -86,15 +86,19 @@ function _Dbg_get_maxline {
typeset fullname=${_Dbg_file2canonic["$1"]}
(( $? != 0 )) && return 1
typeset -i max_line
((max_line=_Dbg_filenames[$fullname].size-1))
# For some reason this doesn't work:
# ((max_line=_Dbg_filenames[$fullname].size-1))
# set -x
(( max_line=${#_Dbg_filenames[$fullname].text[@]}+1 ))
# set +x
print $max_line
return $?
}

# Return text for source line for line $1 of filename $2 in variable
# $_Dbg_source_line.
# $_Dbg_source_line.

# If $2 is omitted, use _Dbg_frame_filename, if $1 is omitted use
# If $2 is omitted, use _Dbg_frame_filename, if $1 is omitted use
# _Dbg_frame_last_lineno. The return value is put in _Dbg_source_line.
_Dbg_get_source_line() {
typeset -i lineno
Expand Down Expand Up @@ -136,7 +140,7 @@ function _Dbg_is_file {
return 1
fi

if [[ ${find_file:0:1} == '/' ]] ; then
if [[ ${find_file:0:1} == '/' ]] ; then
# Absolute file name
if [[ -n ${_Dbg_filenames[$find_file]} ]] ; then
print -- "$find_file"
Expand Down Expand Up @@ -179,17 +183,17 @@ function _Dbg_is_file {

function _Dbg_readin {
typeset filename
if (($# != 0)) ; then
if (($# != 0)) ; then
filename="$1"
else
_Dbg_frame_file
filename="$_Dbg_frame_filename"
fi

if [[ -z $filename ]] || [[ $filename == $_Dbg_bogus_file ]] ; then
if [[ -z $filename ]] || [[ $filename == $_Dbg_bogus_file ]] ; then
# FIXME
return 2
else
else
typeset fullname="$(_Dbg_resolve_expand_filename "$filename")"
if [[ ! -r "$fullname" ]] ; then
return 1
Expand All @@ -203,7 +207,7 @@ function _Dbg_readin {
tempfile=$($highlight_cmd 2>/dev/null)
nameref text=_Dbg_filenames[$fullname].marked_text
_Dbg_readfile text "$tempfile"
fi
fi
_Dbg_file2canonic[$filename]="$fullname"
_Dbg_file2canonic[$fullname]="$fullname"
_Dbg_filenames[$fullname].size=${#text[@]}+1
Expand All @@ -217,7 +221,7 @@ _Dbg_readin_if_new() {
(( $# != 1 )) && return 1
typeset filename="$1"
typeset fullname=${_Dbg_file2canonic["$filename"]}
if [[ -z $fullname ]] ; then
if [[ -z $fullname ]] ; then
_Dbg_readin "$filename"
typeset -i rc=$?
(( rc != 0 )) && return $rc
Expand All @@ -226,4 +230,3 @@ _Dbg_readin_if_new() {
fi
return 0
}

20 changes: 10 additions & 10 deletions lib/frame.sh
Expand Up @@ -10,7 +10,7 @@
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
#
# You should have received a copy of the GNU General Public License along
# with kshdb; see the file COPYING. If not, write to the Free Software
# Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
Expand Down Expand Up @@ -41,7 +41,7 @@ typeset -i _Dbg_stack_pos=0
typeset _Dbg_frame_last_filename=''
typeset -i _Dbg_frame_last_lineno=0

# Note: this code is a bit more convoluted than it need be because of
# Note: this code is a bit more convoluted than it need be because of
# bugs as recent as ksh93t 2008-07-24. These will no doubt be fixed and
# then this code should be redone.

Expand All @@ -68,21 +68,21 @@ _Dbg_frame_adjust() {
((pos=_Dbg_stack_pos+(count*signum)))
fi

if (( pos < 0 )) ; then
if (( pos < 0 )) ; then
_Dbg_errmsg 'Would be beyond bottom-most (most recent) entry.'
return 1
elif (( pos >= ${#_Dbg_frame_stack[@]} )) ; then
elif (( pos >= ${#_Dbg_frame_stack[@]} )) ; then
_Dbg_errmsg 'Would be beyond top-most (least recent) entry.'
return 1
fi

_Dbg_frame_last_filename="${_Dbg_frame_stack[$pos].filename}"
_Dbg_frame_last_lineno=${_Dbg_frame_stack[$pos].lineno}
((_Dbg_stack_pos = pos))

(( _Dbg_stack_pos = pos ))
return 0
}

# Return the frame file for stack $1 or _Dbg_stack_pos if $1
# Return the frame file for stack $1 or _Dbg_stack_pos if $1
# is omitted. If $2 is given, it indicates if we want the basename
# only. Otherwise the $_Dbg_set_basename setting is used.
# 0 is returned if no error, nonzero means some sort of error.
Expand All @@ -105,7 +105,7 @@ _Dbg_frame_int_setup() {
return 1
else
# setopt EXTENDED_GLOB
# if [[ $1 != '' && $1 != ([-+]|)([0-9])## ]] ; then
# if [[ $1 != '' && $1 != ([-+]|)([0-9])## ]] ; then
# _Dbg_msg "Bad integer parameter: $1"
# # Reset EXTENDED_GLOB
# return 1
Expand All @@ -124,7 +124,7 @@ _Dbg_frame_lineno() {
return ${frame.lineno}
}

# Save stack frames in array _Dbg_frame_stack ignoring the
# Save stack frames in array _Dbg_frame_stack ignoring the
# first (most recent) $1 of these.
_Dbg_frame_save_frames() {
integer start=${1:-0}
Expand All @@ -143,7 +143,7 @@ _Dbg_frame_save_frames() {
((.sh.level=.max))
# Reorganize into an array of frame structures
integer _Dbg_i
for ((_Dbg_i=0; _Dbg_i<.max-start; _Dbg_i++)) ; do
for ((_Dbg_i=0; _Dbg_i<.max-start; _Dbg_i++)) ; do
_Dbg_frame_stack[_Dbg_i].filename=${.files[_Dbg_i]}
_Dbg_frame_stack[_Dbg_i].lineno=${.linenos[_Dbg_i]}
_Dbg_frame_stack[_Dbg_i].fun=${.fns[_Dbg_i]}
Expand Down

0 comments on commit 36ad66c

Please sign in to comment.