home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / ld / testsuite / ld-cdtest / cdtest.exp < prev   
Text File  |  1996-09-28  |  3KB  |  101 lines

  1. # Expect script for LD cdtest Tests
  2. #   Copyright (C) 1993,1994,1995 Free Software Foundation
  3. #
  4. # This file is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. #
  16. # Written by Jeffrey Wheat (cassidy@cygnus.com)
  17. # Rewritten by Ian Lance Taylor (ian@cygnus.com)
  18. #
  19.  
  20. # Make sure that constructors are handled correctly.
  21.  
  22. set test1 "cdtest"
  23. set test2 "cdtest with -Ur"
  24.  
  25. # This test requires running the executable generated by ld.
  26. if ![isnative] {
  27.     return
  28. }
  29.  
  30. if { [which $CXX] == 0 } {
  31.     untested $test1
  32.     untested $test2
  33.     return
  34. }
  35.  
  36. if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
  37.      || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
  38.      || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
  39.     unresolved $test1
  40.     unresolved $test2
  41.     return
  42. }
  43.  
  44. if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
  45.     fail $test1
  46. } else {
  47.     send_log "tmpdir/cdtest >tmpdir/cdtest.out\n"
  48.     verbose "tmpdir/cdtest >tmpdir/cdtest.out"
  49.     catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
  50.     if ![string match "" $exec_output] then {
  51.     send_log "$exec_output\n"
  52.     verbose "$exec_output" 1
  53.     fail $test1
  54.     } else {
  55.     send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
  56.     verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
  57.     catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
  58.     set exec_output [prune_system_crud $host_triplet $exec_output]
  59.  
  60.     if [string match "" $exec_output] then {
  61.         pass $test1
  62.     } else {
  63.         send_log "$exec_output\n"
  64.         verbose "$exec_output" 1
  65.         fail $test1
  66.     }
  67.     }
  68. }
  69.  
  70. if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
  71.     fail $test2
  72. } else {
  73.     if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] {
  74.     fail $test2
  75.     } else {
  76.     send_log "tmpdir/cdtest >tmpdir/cdtest.out\n"
  77.     verbose "tmpdir/cdtest >tmpdir/cdtest.out"
  78.     catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
  79.     if ![string match "" $exec_output] then {
  80.         send_log "$exec_output\n"
  81.         verbose "$exec_output" 1
  82.         fail $test2
  83.     } else {
  84.         send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
  85.         verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
  86.         catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
  87.         set exec_output [prune_system_crud $host_triplet $exec_output]
  88.  
  89.         if [string match "" $exec_output] then {
  90.         pass $test2
  91.         } else {
  92.         send_log "$exec_output\n"
  93.         verbose "$exec_output" 1
  94.         fail $test2
  95.         }
  96.     }
  97.     }
  98. }
  99.