From 671fe6e9a3c9608322d666a2e3096b29d592183a Mon Sep 17 00:00:00 2001 From: Jeffrey Wheat Date: Thu, 5 Aug 1993 04:14:51 +0000 Subject: [PATCH] New files for ld testsuites --- ld/testsuite/.Sanitize | 39 +++++++++++ ld/testsuite/config/.Sanitize | 35 ++++++++++ ld/testsuite/config/unix-ld.exp | 75 ++++++++++++++++++++ ld/testsuite/ld.bootstrap/.Sanitize | 36 ++++++++++ ld/testsuite/ld.bootstrap/bootstrap.exp | 91 +++++++++++++++++++++++++ ld/testsuite/lib/.Sanitize | 35 ++++++++++ ld/testsuite/lib/ld.exp | 48 +++++++++++++ 7 files changed, 359 insertions(+) create mode 100644 ld/testsuite/.Sanitize create mode 100644 ld/testsuite/config/.Sanitize create mode 100644 ld/testsuite/config/unix-ld.exp create mode 100644 ld/testsuite/ld.bootstrap/.Sanitize create mode 100644 ld/testsuite/ld.bootstrap/bootstrap.exp create mode 100644 ld/testsuite/lib/.Sanitize create mode 100644 ld/testsuite/lib/ld.exp diff --git a/ld/testsuite/.Sanitize b/ld/testsuite/.Sanitize new file mode 100644 index 0000000000..5d6d39d404 --- /dev/null +++ b/ld/testsuite/.Sanitize @@ -0,0 +1,39 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order.. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +ChangeLog +config +lib +ld.bootstrap + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + +#eof diff --git a/ld/testsuite/config/.Sanitize b/ld/testsuite/config/.Sanitize new file mode 100644 index 0000000000..291f4a9a0c --- /dev/null +++ b/ld/testsuite/config/.Sanitize @@ -0,0 +1,35 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +unix-ld.exp + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: +# eof diff --git a/ld/testsuite/config/unix-ld.exp b/ld/testsuite/config/unix-ld.exp new file mode 100644 index 0000000000..97769386ad --- /dev/null +++ b/ld/testsuite/config/unix-ld.exp @@ -0,0 +1,75 @@ +# +# Expect script for LD Regression Tests +# Copyright (C) 1993 Free Software Foundation +# +# This file 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. */ +# +# $Id$ +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# + +set ld $objdir/ld.new + +# load the utility procedures +load_lib ld.exp + +# +# ld_version -- extract and print the version number of ld compiler (GCC) +# +proc ld_version {} { + global ld + default_ld_version $ld +} + +# +# ld_load +# load the program, for now, we just execute it +# +proc ld_load { target1 target2 } { + global exec_output + + if ![file exists $target1] then { + unresolved "$target1 does not exist." + } + + if ![file exists $target2] then { + unresolved "$target2 does not exist." + } + + set status [catch "exec cmp $target1 $target2" exec_output] + verbose "### COMPARE $target1 $target2\n" + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + return 1 + } else { + return 0 + } +} + +# +# ld_exit -- just a stub for ld +# +proc ld_exit {} { +} + +# +# ld_start +# relink the linker +# +proc ld_start { ld target } { + default_ld_start $ld $target +} diff --git a/ld/testsuite/ld.bootstrap/.Sanitize b/ld/testsuite/ld.bootstrap/.Sanitize new file mode 100644 index 0000000000..abbbecc75c --- /dev/null +++ b/ld/testsuite/ld.bootstrap/.Sanitize @@ -0,0 +1,36 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order.. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +bootstrap.exp + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + +#eof diff --git a/ld/testsuite/ld.bootstrap/bootstrap.exp b/ld/testsuite/ld.bootstrap/bootstrap.exp new file mode 100644 index 0000000000..d817fa0fa0 --- /dev/null +++ b/ld/testsuite/ld.bootstrap/bootstrap.exp @@ -0,0 +1,91 @@ +# +# Expect script for LD Bootstrap Tests +# Copyright (C) 1993 Free Software Foundation +# +# This file 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. */ +# +# $Id$ +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# + +if $tracelevel then { + strace $tracelevel +} + +set tmpdir /tmp + +set stage 0 +# link the target with itself +ld_start $objdir/ld.new $tmpdir/ld.$stage + +# +# main test loop +# +for { set stage 0 } { $stage < 9 } { incr stage } { + + global OFILES + global BFDLIB + global LIBIBERTY + global HOSTING_EMU + global HOSTING_CRT0 + global HOSTING_LIBS + + set status -1 + + set tmpstage $stage + set ld_old $tmpdir/ld.$stage + set ld_new $tmpdir/ld.[incr tmpstage] + + verbose "### Running test $target\n" 1 + verbose "### stage is now $stage\n" 1 + + # link the target with itself + ld_start $ld_old $ld_new + + # load (compare) the target + if ![file exists $ld_old] then { + unresolved "$ld_old doesn't exist." + } + + if ![file exists $ld_new] then { + unresolved "$ld_new doesn't exist." + } + + # compare the old and new targets + set status [ eval ld_load "$ld_old $ld_new" ] + case $status in { + "0" { + pass "$ld_old == $ld_new" + } + "1" { + fail "$tmptarget aborted" + } + "-1" { + error "Couldn't load $tmptarget." + } + } + +# remove generated targets +verbose "### EXEC exec rm -f $ld_old" +catch "exec rm -f $ld_old" result +} + +# remove last generated targets +verbose "### EXEC rm -f $ld_old $ld_new" +catch "exec rm -f $ld_old $ld_new" result +ld_exit + + diff --git a/ld/testsuite/lib/.Sanitize b/ld/testsuite/lib/.Sanitize new file mode 100644 index 0000000000..39bb515026 --- /dev/null +++ b/ld/testsuite/lib/.Sanitize @@ -0,0 +1,35 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +ld.exp + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: +# eof diff --git a/ld/testsuite/lib/ld.exp b/ld/testsuite/lib/ld.exp new file mode 100644 index 0000000000..68a2668129 --- /dev/null +++ b/ld/testsuite/lib/ld.exp @@ -0,0 +1,48 @@ +# +# default_ld_version +# extract and print the version number of ld +# +proc default_ld_version { ld } { + if { [file exists $ld] == 0 } then { + error "$ld does not exist" + exit 1 + } + + set tmp [exec $ld --version] + regexp "version.*$" $tmp version + + if [info exists version] then { + clone_output "$ld $version\n" + } +} + +# +# default_ld_start +# link a program using ld +# +proc default_ld_start { ld target } { + + global OFILES + global BFDLIB + global LIBIBERTY + global HOSTING_EMU + global HOSTING_CRT0 + global HOSTING_LIBS + + set objects "$HOSTING_CRT0 $OFILES" + set library "$BFDLIB $LIBIBERTY $HOSTING_LIBS" + + if { [file exists $ld] == 0 } then { + error "$ld does not exist" + exit 1 + } + + send_log "### EXEC \"$ld $HOSTING_EMU -o $target $objects $library\"\n" + verbose "### EXEC \"$ld $HOSTING_EMU -o $target $objects $library\"" 1 + + catch "exec $ld $HOSTING_EMU -o $target $objects $library" ld_output + if ![string match "" $ld_output] then { + send_log "$ld_output\n" + verbose "$ld_output" 1 + } +} -- 2.34.1