autoconf v2 testsuite
authorMark Eichin <eichin@mit.edu>
Wed, 26 Oct 1994 06:04:44 +0000 (06:04 +0000)
committerMark Eichin <eichin@mit.edu>
Wed, 26 Oct 1994 06:04:44 +0000 (06:04 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4578 dc483132-0cff-0310-8789-dd5450dbe970

src/util/autoconf/testsuite/Makefile.in [new file with mode: 0644]
src/util/autoconf/testsuite/autoconf.g/init.exp [new file with mode: 0644]
src/util/autoconf/testsuite/autoconf.g/sizeof_type.exp [new file with mode: 0644]
src/util/autoconf/testsuite/autoconf.s/defines.exp [new file with mode: 0644]
src/util/autoconf/testsuite/autoconf.s/syntax.exp [new file with mode: 0644]
src/util/autoconf/testsuite/config/unix.exp [new file with mode: 0644]
src/util/autoconf/testsuite/lib/common.exp [new file with mode: 0644]

diff --git a/src/util/autoconf/testsuite/Makefile.in b/src/util/autoconf/testsuite/Makefile.in
new file mode 100644 (file)
index 0000000..950ec90
--- /dev/null
@@ -0,0 +1,78 @@
+# Makefile for Autoconf test suite.
+# Copyright (C) 1994 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+#### Start of system configuration section. ####
+
+top_srcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+M4 = @M4@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+AUTOCONF = ../autoconf
+AUTOCONFFLAGS = -m $(top_srcdir)
+
+RUNTEST= runtest
+RUNTESTFLAGS=
+
+#### End of system configuration section. ####
+
+SHELL = /bin/sh
+
+all:
+info:
+dvi:
+
+check: site.exp all
+       @echo This only works if you have the DejaGNU runtest program installed...
+       $(RUNTEST) $(RUNTESTFLAGS) --tool autoconf AUTOCONF=${AUTOCONF} \
+       AUTOCONFFLAGS="${AUTOCONFFLAGS}" --srcdir $(srcdir)
+
+installcheck:
+
+site.exp: Makefile
+       @echo "Making a new site.exp file..."
+       -@rm -f site.bak
+       -@mv site.exp site.bak
+       @echo "## these variables are automatically generated by make ##" > site.exp
+       @echo "# Do not edit here. If you wish to override these values" >> site.exp
+       @echo "# add them to the last section" >> site.exp
+       @echo "set tool autoconf" >> site.exp
+       @echo "set srcdir ${srcdir}" >> site.exp
+       @echo "set objdir `pwd`" >> site.exp
+       @echo "## All variables above are generated by configure. Do Not Edit ##" >> site.exp
+       -@sed '1,/^## All variables above are.*##/ d' site.bak >> site.exp
+
+install:
+
+install-info:
+
+uninstall:
+
+Makefile: Makefile.in ../config.status
+       cd ..; ./config.status
+
+clean mostlyclean distclean realclean::
+       rm -f autoconf.log autoconf.sum site.exp site.bak AC* confdummy* 
+
+distclean realclean::
+       rm -f Makefile config.status config.cache config.log
+
+TAGS:
diff --git a/src/util/autoconf/testsuite/autoconf.g/init.exp b/src/util/autoconf/testsuite/autoconf.g/init.exp
new file mode 100644 (file)
index 0000000..5efb2d4
--- /dev/null
@@ -0,0 +1,2 @@
+# Test whether AC_INIT and AC_OUTPUT compile.
+autoconf_test AC_INIT ""
diff --git a/src/util/autoconf/testsuite/autoconf.g/sizeof_type.exp b/src/util/autoconf/testsuite/autoconf.g/sizeof_type.exp
new file mode 100644 (file)
index 0000000..c2bf839
--- /dev/null
@@ -0,0 +1 @@
+autoconf_test AC_SIZEOF_TYPE "AC_SIZEOF_TYPE(long *)"
diff --git a/src/util/autoconf/testsuite/autoconf.s/defines.exp b/src/util/autoconf/testsuite/autoconf.s/defines.exp
new file mode 100644 (file)
index 0000000..44be7d8
--- /dev/null
@@ -0,0 +1,49 @@
+# -*- TCL -*-
+# Check for a 1-1 correspondence between acconfig.h and acspecific.m4.
+# Copyright (C) 1994 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Adapted by David MacKenzie from a shell script by Paul Eggert.
+\f
+set top_srcdir "$srcdir/.."
+
+set uscript {s/^#undef[         ]*\([^  ]*\).*/\1/p}
+set undefs [exec sed -n $uscript $top_srcdir/acconfig.h]
+
+set dscript {s/.*AC_DEFINE[A-Z_]*(\([^$,)]*\).*/\1/p; s/.*AC_CHECK_TYPE(\([^$,)]*\).*/\1/p}
+set defines [exec sed -n $dscript $top_srcdir/acspecific.m4]
+
+send_user "Checking acspecific.m4 for definitions of symbols in acconfig.h...\n"
+
+foreach u $undefs {
+    send_user "$u\n"
+    if {[lsearch -exact $defines $u] != -1} {
+       pass "$u"
+    } else {
+       fail "$u, not defined"
+    }
+}
+
+send_user "Checking acconfig.h for symbols defined in acspecific.m4...\n"
+
+foreach d $defines {
+    send_user "$d\n"
+    if {[lsearch -exact $undefs $d] != -1} {
+       pass "$d"
+    } else {
+       fail "$d, no entry"
+    }
+}
diff --git a/src/util/autoconf/testsuite/autoconf.s/syntax.exp b/src/util/autoconf/testsuite/autoconf.s/syntax.exp
new file mode 100644 (file)
index 0000000..95a4611
--- /dev/null
@@ -0,0 +1,10 @@
+# Test all of the acspecific.m4 macros. -*- TCL -*-
+
+send_user "Checking for syntax errors in the specific tests...\n"
+set script {s/^AC_DEFUN(\([^,]*\).*/\1/p}
+set macros [exec sed -n $script $srcdir/../acspecific.m4]
+
+foreach mac $macros {
+    send_user "$mac\n"
+    autoconf_test $mac $mac
+}
diff --git a/src/util/autoconf/testsuite/config/unix.exp b/src/util/autoconf/testsuite/config/unix.exp
new file mode 100644 (file)
index 0000000..ef45d60
--- /dev/null
@@ -0,0 +1,112 @@
+# -*- TCL -*-
+# Test-specific TCL procedures required by DejaGNU.
+# Copyright (C) 1994 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Modified by David MacKenzie <djm@gnu.ai.mit.edu> from the gcc files
+# written by Rob Savoye <rob@cygnus.com>.
+\f
+#
+# Called by runtest.
+# Extract and print the version number of autoconf.
+#
+proc autoconf_version {} {
+    global AUTOCONF
+    global AUTOCONFFLAGS
+
+    if {[which $AUTOCONF] != 0} then {
+       set tmp [ eval exec $AUTOCONF $AUTOCONFFLAGS --version /dev/null ]
+       regexp "version.*$" $tmp version
+       if [info exists version] then {
+           clone_output "[which $AUTOCONF] $version\n"
+       } else {
+           warning "cannot get version from $tmp."
+       }
+    } else {
+       warning "$AUTOCONF, program does not exist"
+    }
+}
+
+#
+# Compile a configure.in using autoconf.
+# Runs autoconf and leaves the output in $comp_output.
+# Called by individual test scripts.
+# Return 1 if ok, 0 if not.
+proc autoconf_start { configout } {
+    global verbose
+    global AUTOCONF
+    global AUTOCONFFLAGS
+    global comp_output
+
+    if {[which $AUTOCONF] == 0} then {
+       error "$AUTOCONF, program does not exist"
+       exit 1
+    }
+
+    set configin "$configout.in"
+
+    send_log "$AUTOCONF $AUTOCONFFLAGS $configin > $configout\n"
+    if $verbose>1 then {
+       send_user "Spawning \"$AUTOCONF $AUTOCONFFLAGS $configin > $configout\"\n"
+    }
+
+    catch "exec $AUTOCONF $AUTOCONFFLAGS $configin > $configout" comp_output
+    if ![string match "" $comp_output] then {
+       send_log "$comp_output\n"
+       if $verbose>1 then {
+           send_user "$comp_output\n"
+       }
+    }
+    catch "exec chmod +x $configout"
+    return 1
+}
+
+#
+# Execute the configure script.
+# Leaves the output in $exec_output.
+# Called by individual test scripts.
+# Return 1 if successful so far, 0 if failure already.
+proc autoconf_load { args } {
+    global verbose
+    global exec_output
+
+    if ![file exists $args] then {
+       error "$args, configure script does not exist"
+       return 0
+    }
+
+    # Capture only stderr in exec_output, not "creating Makefile" etc.
+    catch "exec $args >/dev/null" exec_output
+    if $verbose>1 then {
+       send_user "Executed $args\n"
+    }
+    if ![string match "" $exec_output] then {
+       fail "$args, problem with executing"
+       send_log "$exec_output\n"
+       return 0
+    } else {
+       return 1
+    }
+}
+
+#
+# Called by runtest.
+# Clean up (remove temporary files) before runtest exits.
+#
+proc autoconf_exit {} {
+}
+
+load_lib common.exp
diff --git a/src/util/autoconf/testsuite/lib/common.exp b/src/util/autoconf/testsuite/lib/common.exp
new file mode 100644 (file)
index 0000000..2ebb2d6
--- /dev/null
@@ -0,0 +1,123 @@
+# -*- TCL -*-
+# Auxiliary procedures for autoconf tests.
+# Copyright (C) 1994 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Written by David MacKenzie <djm@gnu.ai.mit.edu>.
+\f
+#
+# Create a configure.in from a string.
+# CONFIG.in is the file to create containing CONTENTS plus boilerplate.
+# Return 1 if successful, 0 if an error occurs.
+proc autoconf_create {config contents} {
+    if [catch {open "$config.in" "w"} hand] {
+       error "$config, cannot create $config.in"
+       return 0
+    }
+    puts $hand "AC_INIT(confdummy.in)
+$contents
+AC_OUTPUT(confdummy)"
+    close $hand
+
+    if [catch {open "confdummy.in" "w"} hand] {
+       error "$config, cannot create confdummy.in"
+       return 0
+    }
+    puts $hand "# This is a dummy file for testing.
+srcdir = @srcdir@
+# Please ignore this file."
+    close $hand
+
+    return 1
+}
+
+# Compile a configure.in into a configure
+#  and call error if there's any output (undefined macros, can't
+#  find library files, etc.).
+proc autoconf_start_plus {configout} {
+    global comp_output
+
+    set status [autoconf_start $configout]
+    if {$status==0} {
+       return 0
+    }
+    # Examine $comp_output.
+    if [string match "*is obsolete*" "$comp_output"] then {
+       return 1
+    }
+    if [string match "*allow cross*" "$comp_output"] then {
+       return 1
+    }
+    if ![string match "" "$comp_output"] then {
+       fail "$configout, problem with running autoconf"
+       return 0
+    }
+    return 1
+}
+
+# Execute a configure script and check the output
+#  against what it's supposed to be.
+# Return 1 if successful so far, 0 if failure already.
+proc autoconf_load_plus {args} {
+    global exec_output
+
+    set status [autoconf_load $args]
+    if {$status==0} {
+       return 0
+    }
+    if [string match "*:*" "$exec_output"] then {
+       fail "$args, problem with executing"
+       return 0
+    }
+    return 1
+}
+
+# Remove generated configuration files for test CONFIG.
+# Return 1 if successful, 0 if not.
+proc autoconf_remove {config} {
+    if [catch "exec rm -f $config $config.in [glob -nocomplain conftest* confdummy*] config.status config.cache config.log"] {
+       warning "$config output files, cannot remove"
+       return 0
+    }
+    return 1
+}
+
+# The standard autoconf test: create, compile, run, and remove
+# a simple configure script to test a single macro.
+# TESTNAME is the name of the macro being tested.
+# CONTENTS is the body of the configure script to create and test.
+proc autoconf_test {testname contents} {
+    if ![autoconf_remove $testname] {
+       return 0
+    }
+    if ![autoconf_create $testname "$contents"] {
+       return 0
+    }
+    if ![autoconf_start_plus $testname] {
+       autoconf_remove $testname
+       return 0
+    }
+    if ![autoconf_load_plus $testname] {
+       autoconf_remove $testname
+       return 0
+    }
+    if ![autoconf_remove $testname] {
+       return 0
+    }
+
+    pass "$testname"
+    return 1
+}