view tests/autoconf/regressiontest.pl @ 4967:0d4c9d0f6a8d

rewrite dynarr code -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-03 Ben Wing <ben@xemacs.org> * device-x.c (x_get_resource_prefix): * device-x.c (Fx_get_resource): * device-x.c (Fx_get_resource_prefix): * device-x.c (Fx_put_resource): * dialog-msw.c: * dialog-msw.c (handle_question_dialog_box): * dired-msw.c (mswindows_sort_files): * dired-msw.c (mswindows_get_files): * extents.c (extent_fragment_sort_by_priority): * extents.c (Fset_extent_parent): * file-coding.c (coding_reader): * file-coding.c (coding_writer): * file-coding.c (gzip_convert): * frame.c (generate_title_string): * gutter.c (calculate_gutter_size_from_display_lines): * indent.c (vmotion_1): * lread.c (read_bit_vector): * mule-coding.c (iso2022_decode): * rangetab.c: * rangetab.c (Fcopy_range_table): * rangetab.c (Fget_range_table): * rangetab.c (unified_range_table_copy_data): * redisplay-msw.c (mswindows_output_string): * redisplay-output.c (output_display_line): * redisplay-output.c (redisplay_move_cursor): * redisplay-output.c (redisplay_clear_bottom_of_window): * redisplay-tty.c (tty_output_ichar_dynarr): * redisplay-tty.c (set_foreground_to): * redisplay-tty.c (set_background_to): * redisplay-xlike-inc.c (XLIKE_output_string): * redisplay.c (redisplay_window_text_width_string): * redisplay.c (redisplay_text_width_string): * redisplay.c (create_text_block): * redisplay.c (SET_CURRENT_MODE_CHARS_PIXSIZE): * redisplay.c (generate_fstring_runes): * redisplay.c (regenerate_modeline): * redisplay.c (ensure_modeline_generated): * redisplay.c (real_current_modeline_height): * redisplay.c (create_string_text_block): * redisplay.c (regenerate_window): * redisplay.c (REGEN_INC_FIND_START_END): * redisplay.c (point_visible): * redisplay.c (redisplay_window): * redisplay.c (mark_glyph_block_dynarr): * redisplay.c (line_start_cache_start): * redisplay.c (start_with_line_at_pixpos): * redisplay.c (update_line_start_cache): * redisplay.c (glyph_to_pixel_translation): * redisplay.c (pixel_to_glyph_translation): * sysdep.c (qxe_readdir): * text.c (dfc_convert_to_external_format): * text.c (dfc_convert_to_internal_format): * toolbar-common.c (common_output_toolbar_button): * window.c (window_modeline_height): * window.c (Fwindow_last_line_visible_height): * window.c (window_displayed_height): * window.c (window_scroll): * window.c (get_current_pixel_pos): Use Dynarr_begin() in place of Dynarr_atp (foo, 0). * dynarr.c (Dynarr_realloc): * dynarr.c (Dynarr_lisp_realloc): * dynarr.c (Dynarr_resize): * dynarr.c (Dynarr_insert_many): * dynarr.c (Dynarr_delete_many): * dynarr.c (Dynarr_memory_usage): * dynarr.c (stack_like_malloc): * dynarr.c (stack_like_free): * lisp.h: * lisp.h (DECLARE_DYNARR_LISP_IMP): * lisp.h (XD_DYNARR_DESC): * lisp.h (Dynarr_pop): * gutter.c (output_gutter): * redisplay-output.c (sync_rune_structs): * redisplay-output.c (redisplay_output_window): Redo the dynarr code, add greater checks. Rename the `len', `largest' and `max' members to `len_', `largest_' and `max_' to try and catch existing places that might directly modify these values. Make new accessors Dynarr_largest() and Dynarr_max() and make them and existing Dynarr_length() be non-lvalues by adding '+ 0' to them; fix a couple of places in the redisplay code that tried to modify the length directly by setting Dynarr_length(). Use the accessors whenever possible even in the dynarr code itself. The accessors also verify that 0 <= len <= largest <= max. Rename settor function Dynarr_set_size() to Dynarr_set_length() and use it more consistently; also create lower-level Dynarr_set_length_1(). This latter function should be the only function that directly modifies the `len_' member of a Dynarr, and in the process makes sure that the `largest' value is kept correct. Consistently use ERROR_CHECK_STRUCTURES instead of ERROR_CHECK_TYPES for error-checking code. Reintroduce the temporarily disabled verification code on the positions of Dynarr_at(), Dynarr_atp() and Dynarr_atp_past_end(). Also create Dynarr_resize_if() in place of a repeated code fragment. Clean up all the functions that modify Dynarrs to use the new macros and functions and verify the correctness of the Dynarr both before and after the change. Note that there are two kinds of verification -- one for accessing and one for modifying. The difference is that the modify verification additionally checks to make sure that the Dynarr isn't locked. (This is used in redisplay to check for problems with reentrancy.) * lrecord.h: Move XD_DYNARR_DESC to lisp.h, grouping with the dynarr code.
author Ben Wing <ben@xemacs.org>
date Wed, 03 Feb 2010 20:51:18 -0600
parents aa5ed11f473b
children 308d34e9f07d
line wrap: on
line source

#!/usr/bin/perl -w
#
# Copyright 2005 Malcolm Purvis
#
# This file is part of XEmacs.
#
# XEmacs is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
#
# XEmacs is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with XEmacs; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# Commentary
#
# Try the new and old versions of configure with various command lines to see
# if they produce identical output.
#
# Invocation: $0 /path/to/old/configure  /path/to/new/configure
#
# Since not all tests use --srcdir, invoke this script from a directory where
# configure can automatically find its input files (Makefile.in.in, etc).  If
# interrupted, it probably will leave its temporary directories behind.  In
# that case, it will error on next invocation, but remove the directories.
# The next invocation will then succeed.
#

use strict;
use File::Basename;

# Files generated by configure.  There should be no functional difference
# between these files generated by 2.13 and those generated by 2.59.
my @output_files =
  (
   "Installation",
   "Makefile.in",
   "./Makefile",
   "./GNUmakefile",
   "lib-src/Makefile.in",
   "lib-src/Makefile",
   "lib-src/GNUmakefile",
#   "lib-src/config.values", # This is specific to the version of autoconf.
   "lib-src/ellcc.h",
   "lwlib/Makefile.in",
   "lwlib/Makefile",
   "lwlib/GNUmakefile",
   "lwlib/config.h",
   "modules/ldap/Makefile.in",
   "modules/ldap/Makefile",
   "modules/ldap/GNUmakefile",
   "modules/postgresql/Makefile.in",
   "modules/postgresql/Makefile",
   "modules/postgresql/GNUmakefile",
   "netinstall/Makefile.in",
   "netinstall/Makefile",
   "src/Makefile.in",
   "src/Makefile",
   "src/GNUmakefile",
   "src/config.h",
   "src/paths.h",
   "src/xemacs.def.in",
   "src/xemacs.def",
  );

# The list of complete command line arguments to test against.  Since the
# command line arguments have changed between 2.13 and 2.59 this hash maps from
# old => new.  If new is 'undef' then the old arguments are used instead.
my %config_args =
  (
   " " => undef,
   "--prefix=/tmp/foo" => undef,
   "--with-gnome" => undef,
   "--with-mule" => "--enable-mule",
# My build flags for MacOS X.  Needs /sw (fink) to be present.
#   "--prefix=/Users/malcolmp/prefix --site-prefixes=/sw --with-sound=none --with-database=no --without-ldap --without-postgresql" =>
#     "--prefix=/Users/malcolmp/prefix --with-site-prefixes=/sw --disable-sound --disable-database --without-ldap --without-postgresql",
# My build flags for Linux (powerpc64)
   "--prefix=/usr/local/gcc3-world --package-path=/usr/local/lib/xemacs" =>
     "--prefix=/usr/local/gcc3-world --with-package-path=/usr/local/lib/xemacs",
   "--use_union_type" => "--enable-union-type",
   "--use_kkcc" => "--enable-kkcc",
   "--xemacs-compiler=g++" => "--with-xemacs-compiler=g++",
   "--lispdir=/tmp/foo" => "--with-lispdir=/tmp/foo",
   "--moduledir=/tmp/foo" => "--with-moduledir=/tmp/foo",
   "--etcdir=/tmp/foo" => "--with-etcdir=/tmp/foo",
   "--infopath=/tmp/foo" => "--with-infopath=/tmp/foo",
   "--archlibdir=/tmp/foo" => "--with-archlibdir=/tmp/foo",
   "--docdir=/tmp/foo" => "--with-docdir=/tmp/foo",
   "--package-prefix=/tmp/foo" => "--with-package-prefix=/tmp/foo",
   "--package-path=/tmp/foo" => "--with-package-path=/tmp/foo",
   "--datadir=/tmp/foo" => undef,
   "--mandir=/tmp/foo" => undef,
   "--infodir=/tmp/foo" => undef,
   "--libdir=/tmp/foo" => undef,
   "--exec-prefix=/tmp/foo" => undef,
   "--with-athena=3d" => undef,
   "--with-mule --with-xft=emacs --debug --error-checking=all --with-xim=xlib --with-widgets=athena --with-athena=3d --with-dialogs=athena --memory-usage-stats --use-number-lib=gmp --site-prefixes=/opt/local:/sw --with-ldap=no --use-union-type" => "--enable-mule --with-xft=emacs --enable-debug --enable-error-checking=all --with-xim=xlib --enable-widgets=athena --with-athena=3d --enable-dialogs=athena --enable-memory-usage-stats --enable-bignum=gmp --with-site-prefixes=/opt/local:/sw --with-ldap=no --enable-union-type"
  );

die "Usage: $0 /path/to/configure-2.13 /path/to/configure-2.59\n" if scalar(@ARGV) != 2;

my $old_configure = $ARGV[0];
my $new_configure = $ARGV[1];
my $old_dir = dirname($old_configure);
my $new_dir = dirname($new_configure);

foreach my $old_arg (keys %config_args) {
  mkdir "/tmp/old" or die "$0: Cannot create /tmp/old: $!\n";
  mkdir "/tmp/new" or die "$0: Cannot create /tmp/new: $!\n";

  my $new_arg = $config_args{$old_arg};
  $new_arg = $old_arg if ! defined($new_arg);

  print "--------------------------------------------------\n";
  print "$old_configure $old_arg\n";
  print "$new_configure $new_arg\n";

  chdir "/tmp/old" or die "$0: Cannot cd to /tmp/old: $!\n";
  system ("$old_configure $old_arg >/tmp/old-output.txt\n") == 0 or
    die "$0: $old_configure $old_arg failed\n";

  chdir "/tmp/new" or die "$0: Cannot cd to /tmp/new: $!\n";
  system ("$new_configure $new_arg >/tmp/new-output.txt\n") == 0 or
    die "$0: $new_configure $new_arg failed\n";

  foreach my $file (@output_files) {
    if (-r "/tmp/old/$file" && -r "/tmp/new/$file") {
# Strip out parts that always differ: Paths and the 'Generated by configure'
# lines.
      system("for i in /tmp/old/$file /tmp/new/$file ; do sed -e '/HAVE_DECL_SYS_SIGLIST/d' -e '\\!$old_configure!d' -e '\\!$new_configure!d' -e '/EMACS_CONFIG_OPTIONS/d' -e '/Generated.*configure/d' -e '\\!$old_dir!s///' -e '\\!$new_dir!s///' -e '\\!/tmp/new!s///' -e '\\!/tmp/old!s///' <\$i >\$i.processed ; done");
# Compare the processed versions.  These should be the same.
      system "diff -U 0 -L old-$file -L new-$file /tmp/old/$file.processed /tmp/new/$file.processed";
    }
  }
  chdir "/";
  system("rm -rf /tmp/old /tmp/new");
}

END {
  chdir "/";
  system("rm -rf /tmp/old /tmp/new");
}