OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [ld/] [testsuite/] [ld-d10v/] [d10v.exp] - Diff between revs 38 and 156

Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 156
# Expect script for ld-d10v tests
# Expect script for ld-d10v tests
# Copyright 2002, 2007 Free Software Foundation, Inc.
# Copyright 2002, 2007 Free Software Foundation, Inc.
#
#
# This file is part of the GNU Binutils.
# This file is part of the GNU Binutils.
#
#
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
# MA 02110-1301, USA.
#
#
# Written by Tom Rix, trix@redhat.com
# Written by Tom Rix, trix@redhat.com
#
#
# Test d10v
# Test d10v
if ![istarget d10v-*-*] {
if ![istarget d10v-*-*] {
    return
    return
}
}
# run_link_test FILE
# run_link_test FILE
# Copied from run_dump_test, with the dumping part removed.
# Copied from run_dump_test, with the dumping part removed.
#
#
# Assemble a .s file, then run some utility on it and check the output.
# Assemble a .s file, then run some utility on it and check the output.
#
#
# There should be an assembly language file named FILE.s in the test
# There should be an assembly language file named FILE.s in the test
# suite directory.  `run_link_test' will assemble and link FILE.s
# suite directory.  `run_link_test' will assemble and link FILE.s
#
#
# The FILE.lt file begins with zero or more option lines, which specify
# The FILE.lt file begins with zero or more option lines, which specify
# flags to pass to the assembler, the program to run to dump the
# flags to pass to the assembler, the program to run to dump the
# assembler's output, and the options it wants.  The option lines have
# assembler's output, and the options it wants.  The option lines have
# the syntax:
# the syntax:
#
#
#         # OPTION: VALUE
#         # OPTION: VALUE
#
#
# OPTION is the name of some option, like "name" or "ld", and
# OPTION is the name of some option, like "name" or "ld", and
# VALUE is OPTION's value.  The valid options are described below.
# VALUE is OPTION's value.  The valid options are described below.
# Whitespace is ignored everywhere, except within VALUE.  The option
# Whitespace is ignored everywhere, except within VALUE.  The option
# list ends with the first line that doesn't match the above syntax
# list ends with the first line that doesn't match the above syntax
# (hmm, not great for error detection).
# (hmm, not great for error detection).
#
#
# The interesting options are:
# The interesting options are:
#
#
#   name: TEST-NAME
#   name: TEST-NAME
#       The name of this test, passed to DejaGNU's `pass' and `fail'
#       The name of this test, passed to DejaGNU's `pass' and `fail'
#       commands.  If omitted, this defaults to FILE, the root of the
#       commands.  If omitted, this defaults to FILE, the root of the
#       .s and .d files' names.
#       .s and .d files' names.
#
#
#   as: FLAGS
#   as: FLAGS
#       When assembling, pass FLAGS to the assembler.
#       When assembling, pass FLAGS to the assembler.
#       If assembling several files, you can pass different assembler
#       If assembling several files, you can pass different assembler
#       options in the "source" directives.  See below.
#       options in the "source" directives.  See below.
#
#
#   ld: FLAGS
#   ld: FLAGS
#       Link assembled files using FLAGS, in the order of the "source"
#       Link assembled files using FLAGS, in the order of the "source"
#       directives, when using multiple files.
#       directives, when using multiple files.
#
#
#   source: SOURCE [FLAGS]
#   source: SOURCE [FLAGS]
#       Assemble the file SOURCE.s using the flags in the "as" directive
#       Assemble the file SOURCE.s using the flags in the "as" directive
#       and the (optional) FLAGS.  If omitted, the source defaults to
#       and the (optional) FLAGS.  If omitted, the source defaults to
#       FILE.s.
#       FILE.s.
#       This is useful if several .x files want to share a .s file.
#       This is useful if several .x files want to share a .s file.
#       More than one "source" directive can be given, which is useful
#       More than one "source" directive can be given, which is useful
#       when testing linking.
#       when testing linking.
#
#
#   xfail: TARGET
#   xfail: TARGET
#       The test is expected to fail on TARGET.  This may occur more than
#       The test is expected to fail on TARGET.  This may occur more than
#       once.
#       once.
#
#
#   target: TARGET
#   target: TARGET
#       Only run the test for TARGET.  This may occur more than once; the
#       Only run the test for TARGET.  This may occur more than once; the
#       target being tested must match at least one.
#       target being tested must match at least one.
#
#
#   notarget: TARGET
#   notarget: TARGET
#       Do not run the test for TARGET.  This may occur more than once;
#       Do not run the test for TARGET.  This may occur more than once;
#       the target being tested must not match any of them.
#       the target being tested must not match any of them.
#
#
# Each option may occur at most once unless otherwise mentioned.
# Each option may occur at most once unless otherwise mentioned.
#
#
proc run_link_test { name } {
proc run_link_test { name } {
    global subdir srcdir
    global subdir srcdir
    global AS LD
    global AS LD
    global ASFLAGS LDFLAGS
    global ASFLAGS LDFLAGS
    global host_triplet runtests
    global host_triplet runtests
    if [string match "*/*" $name] {
    if [string match "*/*" $name] {
        set file $name
        set file $name
        set name [file tail $name]
        set name [file tail $name]
    } else {
    } else {
        set file "$srcdir/$subdir/$name"
        set file "$srcdir/$subdir/$name"
    }
    }
    if ![runtest_file_p $runtests $name] then {
    if ![runtest_file_p $runtests $name] then {
        return
        return
    }
    }
    set opt_array [slurp_options "${file}.lt"]
    set opt_array [slurp_options "${file}.lt"]
    if { $opt_array == -1 } {
    if { $opt_array == -1 } {
        perror "error reading options from $file.lt"
        perror "error reading options from $file.lt"
        unresolved $subdir/$name
        unresolved $subdir/$name
        return
        return
    }
    }
    set dumpfile tmpdir/dump.out
    set dumpfile tmpdir/dump.out
    set run_ld 0
    set run_ld 0
    set opts(as) {}
    set opts(as) {}
    set opts(ld) {}
    set opts(ld) {}
    set opts(xfail) {}
    set opts(xfail) {}
    set opts(target) {}
    set opts(target) {}
    set opts(notarget) {}
    set opts(notarget) {}
    set opts(name) {}
    set opts(name) {}
    set opts(source) {}
    set opts(source) {}
    set asflags(${file}.s) {}
    set asflags(${file}.s) {}
    foreach i $opt_array {
    foreach i $opt_array {
        set opt_name [lindex $i 0]
        set opt_name [lindex $i 0]
        set opt_val [lindex $i 1]
        set opt_val [lindex $i 1]
        if ![info exists opts($opt_name)] {
        if ![info exists opts($opt_name)] {
            perror "unknown option $opt_name in file $file.lt"
            perror "unknown option $opt_name in file $file.lt"
            unresolved $subdir/$name
            unresolved $subdir/$name
            return
            return
        }
        }
        switch -- $opt_name {
        switch -- $opt_name {
            xfail {}
            xfail {}
            target {}
            target {}
            notarget {}
            notarget {}
            source {
            source {
                # Move any source-specific as-flags to a separate array to
                # Move any source-specific as-flags to a separate array to
                # simplify processing.
                # simplify processing.
                if { [llength $opt_val] > 1 } {
                if { [llength $opt_val] > 1 } {
                    set asflags([lindex $opt_val 0]) [lrange $opt_val 1 end]
                    set asflags([lindex $opt_val 0]) [lrange $opt_val 1 end]
                    set opt_val [lindex $opt_val 0]
                    set opt_val [lindex $opt_val 0]
                } else {
                } else {
                    set asflags($opt_val) {}
                    set asflags($opt_val) {}
                }
                }
            }
            }
            default {
            default {
                if [string length $opts($opt_name)] {
                if [string length $opts($opt_name)] {
                    perror "option $opt_name multiply set in $file.lt"
                    perror "option $opt_name multiply set in $file.lt"
                    unresolved $subdir/$name
                    unresolved $subdir/$name
                    return
                    return
                }
                }
            }
            }
        }
        }
        set opts($opt_name) [concat $opts($opt_name) $opt_val]
        set opts($opt_name) [concat $opts($opt_name) $opt_val]
    }
    }
    # Decide early whether we should run the test for this target.
    # Decide early whether we should run the test for this target.
    if { [llength $opts(target)] > 0 } {
    if { [llength $opts(target)] > 0 } {
        set targmatch 0
        set targmatch 0
        foreach targ $opts(target) {
        foreach targ $opts(target) {
            if [istarget $targ] {
            if [istarget $targ] {
                set targmatch 1
                set targmatch 1
                break
                break
            }
            }
        }
        }
        if { $targmatch == 0 } {
        if { $targmatch == 0 } {
            return
            return
        }
        }
    }
    }
    foreach targ $opts(notarget) {
    foreach targ $opts(notarget) {
        if [istarget $targ] {
        if [istarget $targ] {
            return
            return
        }
        }
    }
    }
    if { $opts(name) == "" } {
    if { $opts(name) == "" } {
        set testname "$subdir/$name"
        set testname "$subdir/$name"
    } else {
    } else {
        set testname $opts(name)
        set testname $opts(name)
    }
    }
    if { $opts(source) == "" } {
    if { $opts(source) == "" } {
        set sourcefiles [list ${file}.s]
        set sourcefiles [list ${file}.s]
    } else {
    } else {
        set sourcefiles {}
        set sourcefiles {}
        foreach sf $opts(source) {
        foreach sf $opts(source) {
            lappend sourcefiles "$srcdir/$subdir/$sf"
            lappend sourcefiles "$srcdir/$subdir/$sf"
            # Must have asflags indexed on source name.
            # Must have asflags indexed on source name.
            set asflags($srcdir/$subdir/$sf) $asflags($sf)
            set asflags($srcdir/$subdir/$sf) $asflags($sf)
        }
        }
    }
    }
    # Time to setup xfailures.
    # Time to setup xfailures.
    foreach targ $opts(xfail) {
    foreach targ $opts(xfail) {
        setup_xfail $targ
        setup_xfail $targ
    }
    }
    # Assemble each file.
    # Assemble each file.
    set objfiles {}
    set objfiles {}
    for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
    for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
        set sourcefile [lindex $sourcefiles $i]
        set sourcefile [lindex $sourcefiles $i]
        set objfile "tmpdir/dump$i.o"
        set objfile "tmpdir/dump$i.o"
        lappend objfiles $objfile
        lappend objfiles $objfile
        set cmd "$AS $ASFLAGS $opts(as) $asflags($sourcefile) -o $objfile $sourcefile"
        set cmd "$AS $ASFLAGS $opts(as) $asflags($sourcefile) -o $objfile $sourcefile"
        send_log "$cmd\n"
        send_log "$cmd\n"
        set cmdret [catch "exec $cmd" comp_output]
        set cmdret [catch "exec $cmd" comp_output]
        set comp_output [prune_warnings $comp_output]
        set comp_output [prune_warnings $comp_output]
        # We accept errors at assembly stage too, unless we're supposed to
        # We accept errors at assembly stage too, unless we're supposed to
        # link something.
        # link something.
        if { $cmdret != 0 || ![string match "" $comp_output] } then {
        if { $cmdret != 0 || ![string match "" $comp_output] } then {
            send_log "$comp_output\n"
            send_log "$comp_output\n"
            verbose "$comp_output" 3
            verbose "$comp_output" 3
            fail $testname
            fail $testname
            return
            return
        }
        }
    }
    }
    # Link the file(s).
    # Link the file(s).
    set objfile "tmpdir/dump"
    set objfile "tmpdir/dump"
    set cmd "$LD $LDFLAGS $opts(ld) -o $objfile $objfiles"
    set cmd "$LD $LDFLAGS $opts(ld) -o $objfile $objfiles"
    send_log "$cmd\n"
    send_log "$cmd\n"
    set cmdret [catch "exec $cmd" comp_output]
    set cmdret [catch "exec $cmd" comp_output]
    set comp_output [prune_warnings $comp_output]
    set comp_output [prune_warnings $comp_output]
    if { $cmdret != 0 || ![string match "" $comp_output] } then {
    if { $cmdret != 0 || ![string match "" $comp_output] } then {
        send_log "$comp_output\n"
        send_log "$comp_output\n"
        verbose "$comp_output" 3
        verbose "$comp_output" 3
        fail $testname
        fail $testname
        return
        return
    }
    }
    pass $testname
    pass $testname
}
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach test $test_list {
foreach test $test_list {
    # We need to strip the ".d", but can leave the dirname.
    # We need to strip the ".d", but can leave the dirname.
    verbose [file rootname $test]
    verbose [file rootname $test]
    run_dump_test [file rootname $test]
    run_dump_test [file rootname $test]
}
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.lt]]
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.lt]]
foreach test $test_list {
foreach test $test_list {
    # We need to strip the ".lt", but can leave the dirname.
    # We need to strip the ".lt", but can leave the dirname.
    verbose [file rootname $test]
    verbose [file rootname $test]
    run_link_test [file rootname $test]
    run_link_test [file rootname $test]
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.