New files for ld testsuites

This commit is contained in:
Jeffrey Wheat 1993-08-05 04:14:51 +00:00
parent 8bf66be8aa
commit 671fe6e9a3
7 changed files with 359 additions and 0 deletions

39
ld/testsuite/.Sanitize Normal file
View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

48
ld/testsuite/lib/ld.exp Normal file
View File

@ -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
}
}