bfd:
[deliverable/binutils-gdb.git] / ld / testsuite / lib / ld-lib.exp
1 # Support routines for LD testsuite.
2 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3 # 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4 #
5 # This file is part of the GNU Binutils.
6 #
7 # This file is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 # MA 02110-1301, USA.
21
22 # Extract and print the version number of ld.
23 #
24 proc default_ld_version { ld } {
25 global host_triplet
26
27 if { ![is_remote host] && [which $ld] == 0 } then {
28 perror "$ld does not exist"
29 exit 1
30 }
31
32 remote_exec host "$ld --version" "" "/dev/null" "ld.version"
33 remote_upload host "ld.version"
34 set tmp [prune_warnings [file_contents "ld.version"]]
35 remote_file build delete "ld.version"
36 remote_file host delete "ld.version"
37
38 regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
39 if [info exists number] then {
40 clone_output "$ld $number\n"
41 }
42 }
43
44 proc run_host_cmd { prog command } {
45 global link_output
46
47 if { ![is_remote host] && [which "$prog"] == 0 } then {
48 perror "$prog does not exist"
49 return 0
50 }
51
52 verbose -log "$prog $command"
53 set status [remote_exec host [concat sh -c [list "$prog $command 2>&1"]] "" "/dev/null" "ld.tmp"]
54 remote_upload host "ld.tmp"
55 set link_output [file_contents "ld.tmp"]
56 regsub "\n$" $link_output "" link_output
57 if { [lindex $status 0] != 0 && [string match "" $link_output] } then {
58 append link_output "child process exited abnormally"
59 }
60 remote_file build delete ld.tmp
61 remote_file host delete ld.tmp
62
63 if [string match "" $link_output] then {
64 return ""
65 }
66
67 verbose -log "$link_output"
68 return "$link_output"
69 }
70
71 proc run_host_cmd_yesno { prog command } {
72 global exec_output
73
74 set exec_output [prune_warnings [run_host_cmd "$prog" "$command"]]
75 if [string match "" $exec_output] then {
76 return 1;
77 }
78 return 0;
79 }
80
81 # Link an object using relocation.
82 #
83 proc default_ld_relocate { ld target objects } {
84 global HOSTING_EMU
85
86 remote_file host delete $target
87 return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
88 }
89
90 # Check to see if ld is being invoked with a non-endian output format
91 #
92 proc is_endian_output_format { object_flags } {
93
94 if {[string match "*-oformat binary*" $object_flags] || \
95 [string match "*-oformat ieee*" $object_flags] || \
96 [string match "*-oformat ihex*" $object_flags] || \
97 [string match "*-oformat netbsd-core*" $object_flags] || \
98 [string match "*-oformat srec*" $object_flags] || \
99 [string match "*-oformat tekhex*" $object_flags] || \
100 [string match "*-oformat trad-core*" $object_flags] } then {
101 return 0
102 } else {
103 return 1
104 }
105 }
106
107 # Look for big-endian or little-endian switches in the multlib
108 # options and translate these into a -EB or -EL switch. Note
109 # we cannot rely upon proc process_multilib_options to do this
110 # for us because for some targets the compiler does not support
111 # -EB/-EL but it does support -mbig-endian/-mlittle-endian, and
112 # the site.exp file will include the switch "-mbig-endian"
113 # (rather than "big-endian") which is not detected by proc
114 # process_multilib_options.
115 #
116 proc big_or_little_endian {} {
117
118 if [board_info [target_info name] exists multilib_flags] {
119 set tmp_flags " [board_info [target_info name] multilib_flags]"
120
121 foreach x $tmp_flags {
122 case $x in {
123 {*big*endian eb EB -eb -EB -mb -meb} {
124 set flags " -EB"
125 return $flags
126 }
127 {*little*endian el EL -el -EL -ml -mel} {
128 set flags " -EL"
129 return $flags
130 }
131 }
132 }
133 }
134
135 set flags ""
136 return $flags
137 }
138
139 # Link a program using ld.
140 #
141 proc default_ld_link { ld target objects } {
142 global HOSTING_EMU
143 global HOSTING_CRT0
144 global HOSTING_LIBS
145 global LIBS
146 global host_triplet
147 global link_output
148 global exec_output
149
150 set objs "$HOSTING_CRT0 $objects"
151 set libs "$LIBS $HOSTING_LIBS"
152
153 if [is_endian_output_format $objects] then {
154 set flags [big_or_little_endian]
155 } else {
156 set flags ""
157 }
158
159 remote_file host delete $target
160
161 return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"]
162 }
163
164 # Link a program using ld, without including any libraries.
165 #
166 proc default_ld_simple_link { ld target objects } {
167 global host_triplet
168 global gcc_ld_flag
169 global exec_output
170
171 if [is_endian_output_format $objects] then {
172 set flags [big_or_little_endian]
173 } else {
174 set flags ""
175 }
176
177 # If we are compiling with gcc, we want to add gcc_ld_flag to
178 # flags. Rather than determine this in some complex way, we guess
179 # based on the name of the compiler.
180 set ldexe $ld
181 set ldparm [string first " " $ld]
182 if { $ldparm > 0 } then {
183 set ldexe [string range $ld 0 $ldparm]
184 }
185 set ldexe [string replace $ldexe 0 [string last "/" $ldexe] ""]
186 if {[string match "*gcc*" $ldexe] || [string match "*++*" $ldexe]} then {
187 set flags "$gcc_ld_flag $flags"
188 }
189
190 remote_file host delete $target
191
192 set exec_output [run_host_cmd "$ld" "$flags -o $target $objects"]
193 set exec_output [prune_warnings $exec_output]
194
195 # We don't care if we get a warning about a non-existent start
196 # symbol, since the default linker script might use ENTRY.
197 regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
198
199 if [string match "" $exec_output] then {
200 return 1
201 } else {
202 return 0
203 }
204 }
205
206 # Compile an object using cc.
207 #
208 proc default_ld_compile { cc source object } {
209 global CFLAGS
210 global srcdir
211 global subdir
212 global host_triplet
213 global gcc_gas_flag
214
215 set cc_prog $cc
216 if {[llength $cc_prog] > 1} then {
217 set cc_prog [lindex $cc_prog 0]
218 }
219 if {![is_remote host] && [which $cc_prog] == 0} then {
220 perror "$cc_prog does not exist"
221 return 0
222 }
223
224 remote_file build delete "$object"
225 remote_file host delete "$object"
226
227 set flags "-I$srcdir/$subdir $CFLAGS"
228
229 # If we are compiling with gcc, we want to add gcc_gas_flag to
230 # flags. Rather than determine this in some complex way, we guess
231 # based on the name of the compiler.
232 set ccexe $cc
233 set ccparm [string first " " $cc]
234 set ccflags ""
235 if { $ccparm > 0 } then {
236 set ccflags [string range $cc $ccparm end]
237 set ccexe [string range $cc 0 $ccparm]
238 set cc $ccexe
239 }
240 set ccexe [string replace $ccexe 0 [string last "/" $ccexe] ""]
241 if {[string match "*gcc*" $ccexe] || [string match "*++*" $ccexe]} then {
242 set flags "$gcc_gas_flag $flags"
243 }
244
245 if [board_info [target_info name] exists multilib_flags] {
246 append flags " [board_info [target_info name] multilib_flags]"
247 }
248
249 verbose -log "$cc $flags $ccflags -c $source -o $object"
250
251 set status [remote_exec host [concat sh -c [list "$cc $flags $ccflags -c $source -o $object 2>&1"]] "" "/dev/null" "ld.tmp"]
252 remote_upload host "ld.tmp"
253 set exec_output [file_contents "ld.tmp"]
254 remote_file build delete "ld.tmp"
255 remote_file host delete "ld.tmp"
256 set exec_output [prune_warnings $exec_output]
257 if [string match "" $exec_output] then {
258 if {![file exists $object]} then {
259 regexp ".*/(\[^/\]*)$" $source all dobj
260 regsub "\\.c" $dobj ".o" realobj
261 verbose "looking for $realobj"
262 if {[remote_file host exists $realobj]} then {
263 verbose -log "mv $realobj $object"
264 remote_upload "$realobj" "$object"
265 } else {
266 perror "$object not found after compilation"
267 return 0
268 }
269 }
270 return 1
271 } else {
272 verbose -log "$exec_output"
273 perror "$source: compilation failed"
274 return 0
275 }
276 }
277
278 # Assemble a file.
279 #
280 proc default_ld_assemble { as source object } {
281 global ASFLAGS
282 global host_triplet
283
284 if ![info exists ASFLAGS] { set ASFLAGS "" }
285
286 set flags [big_or_little_endian]
287 set exec_output [run_host_cmd "$as" "$flags $ASFLAGS -o $object $source"]
288 set exec_output [prune_warnings $exec_output]
289 if [string match "" $exec_output] then {
290 return 1
291 } else {
292 perror "$source: assembly failed"
293 return 0
294 }
295 }
296
297 # Run nm on a file, putting the result in the array nm_output.
298 #
299 proc default_ld_nm { nm nmflags object } {
300 global NMFLAGS
301 global nm_output
302 global host_triplet
303
304 if {[info exists nm_output]} {
305 unset nm_output
306 }
307
308 if ![info exists NMFLAGS] { set NMFLAGS "" }
309
310 # Ensure consistent sorting of symbols
311 if {[info exists env(LC_ALL)]} {
312 set old_lc_all $env(LC_ALL)
313 }
314 set env(LC_ALL) "C"
315
316 verbose -log "$nm $NMFLAGS $nmflags $object >tmpdir/nm.out"
317
318 set status [remote_exec host [concat sh -c [list "$nm $NMFLAGS $nmflags $object 2>ld.stderr"]] "" "/dev/null" "tmpdir/nm.out"]
319 if {[info exists old_lc_all]} {
320 set env(LC_ALL) $old_lc_all
321 } else {
322 unset env(LC_ALL)
323 }
324 remote_upload host "ld.stderr"
325 remote_upload host "tmpdir/nm.out" "tmpdir/nm.out"
326 set exec_output [prune_warnings [file_contents "ld.stderr"]]
327 remote_file host delete "ld.stderr"
328 remote_file build delete "ld.stderr"
329 if [string match "" $exec_output] then {
330 set file [open tmpdir/nm.out r]
331 while { [gets $file line] != -1 } {
332 verbose "$line" 2
333 if [regexp "^(\[0-9a-fA-F\]+) \[a-zA-Z0-9\] \\.*(.+)$" $line whole value name] {
334 set name [string trimleft $name "_"]
335 verbose "Setting nm_output($name) to 0x$value" 2
336 set nm_output($name) 0x$value
337 }
338 }
339 close $file
340 return 1
341 } else {
342 verbose -log "$exec_output"
343 perror "$object: nm failed"
344 return 0
345 }
346 }
347
348 # True if the object format is known to be ELF.
349 #
350 proc is_elf_format {} {
351 if { ![istarget *-*-sysv4*] \
352 && ![istarget *-*-unixware*] \
353 && ![istarget *-*-elf*] \
354 && ![istarget *-*-eabi*] \
355 && ![istarget hppa*64*-*-hpux*] \
356 && ![istarget *-*-linux*] \
357 && ![istarget frv-*-uclinux*] \
358 && ![istarget *-*-irix5*] \
359 && ![istarget *-*-irix6*] \
360 && ![istarget *-*-netbsd*] \
361 && ![istarget *-*-solaris2*] } {
362 return 0
363 }
364
365 if { [istarget *-*-linux*aout*] \
366 || [istarget *-*-linux*oldld*] } {
367 return 0
368 }
369
370 if { ![istarget *-*-netbsdelf*] \
371 && ([istarget *-*-netbsd*aout*] \
372 || [istarget *-*-netbsdpe*] \
373 || [istarget arm*-*-netbsd*] \
374 || [istarget sparc-*-netbsd*] \
375 || [istarget i*86-*-netbsd*] \
376 || [istarget m68*-*-netbsd*] \
377 || [istarget vax-*-netbsd*] \
378 || [istarget ns32k-*-netbsd*]) } {
379 return 0
380 }
381 return 1
382 }
383
384 # True if the object format is known to be 64-bit ELF.
385 #
386 proc is_elf64 { binary_file } {
387 global READELF
388 global READELFFLAGS
389
390 set readelf_size ""
391 catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got
392
393 if ![string match "" $got] then {
394 return 0
395 }
396
397 if { ![regexp "\n\[ \]*Class:\[ \]*ELF(\[0-9\]+)\n" \
398 [file_contents readelf.out] nil readelf_size] } {
399 return 0
400 }
401
402 if { $readelf_size == "64" } {
403 return 1
404 }
405
406 return 0
407 }
408
409 # True if the object format is known to be a.out.
410 #
411 proc is_aout_format {} {
412 if { [istarget *-*-*\[ab\]out*] \
413 || [istarget *-*-linux*oldld*] \
414 || [istarget *-*-msdos*] \
415 || [istarget arm-*-netbsd] \
416 || [istarget i?86-*-netbsd] \
417 || [istarget i?86-*-mach*] \
418 || [istarget i?86-*-vsta] \
419 || [istarget pdp11-*-*] \
420 || [istarget m68*-ericsson-ose] \
421 || [istarget m68k-hp-bsd*] \
422 || [istarget m68*-*-hpux*] \
423 || [istarget m68*-*-netbsd] \
424 || [istarget m68*-*-netbsd*4k*] \
425 || [istarget m68k-sony-*] \
426 || [istarget m68*-sun-sunos\[34\]*] \
427 || [istarget m68*-wrs-vxworks*] \
428 || [istarget ns32k-*-*] \
429 || [istarget sparc*-*-netbsd] \
430 || [istarget sparc-sun-sunos4*] \
431 || [istarget vax-dec-ultrix*] \
432 || [istarget vax-*-netbsd] } {
433 return 1
434 }
435 return 0
436 }
437
438 # True if the object format is known to be PE COFF.
439 #
440 proc is_pecoff_format {} {
441 if { ![istarget *-*-mingw*] \
442 && ![istarget *-*-cygwin*] \
443 && ![istarget *-*-pe*] } {
444 return 0
445 }
446
447 return 1
448 }
449
450 # Compares two files line-by-line.
451 # Returns differences if exist.
452 # Returns null if file(s) cannot be opened.
453 #
454 proc simple_diff { file_1 file_2 } {
455 global target
456
457 set eof -1
458 set differences 0
459
460 if [file exists $file_1] then {
461 set file_a [open $file_1 r]
462 } else {
463 warning "$file_1 doesn't exist"
464 return
465 }
466
467 if [file exists $file_2] then {
468 set file_b [open $file_2 r]
469 } else {
470 fail "$file_2 doesn't exist"
471 return
472 }
473
474 verbose "# Diff'ing: $file_1 $file_2\n" 2
475
476 while { [gets $file_a line] != $eof } {
477 if [regexp "^#.*$" $line] then {
478 continue
479 } else {
480 lappend list_a $line
481 }
482 }
483 close $file_a
484
485 while { [gets $file_b line] != $eof } {
486 if [regexp "^#.*$" $line] then {
487 continue
488 } else {
489 lappend list_b $line
490 }
491 }
492 close $file_b
493
494 for { set i 0 } { $i < [llength $list_a] } { incr i } {
495 set line_a [lindex $list_a $i]
496 set line_b [lindex $list_b $i]
497
498 verbose "\t$file_1: $i: $line_a\n" 3
499 verbose "\t$file_2: $i: $line_b\n" 3
500 if [string compare $line_a $line_b] then {
501 verbose -log "\t$file_1: $i: $line_a\n"
502 verbose -log "\t$file_2: $i: $line_b\n"
503
504 fail "Test: $target"
505 return
506 }
507 }
508
509 if { [llength $list_a] != [llength $list_b] } {
510 fail "Test: $target"
511 return
512 }
513
514 if $differences<1 then {
515 pass "Test: $target"
516 }
517 }
518
519 # run_dump_test FILE
520 # Copied from gas testsuite, tweaked and further extended.
521 #
522 # Assemble a .s file, then run some utility on it and check the output.
523 #
524 # There should be an assembly language file named FILE.s in the test
525 # suite directory, and a pattern file called FILE.d. `run_dump_test'
526 # will assemble FILE.s, run some tool like `objdump', `objcopy', or
527 # `nm' on the .o file to produce textual output, and then analyze that
528 # with regexps. The FILE.d file specifies what program to run, and
529 # what to expect in its output.
530 #
531 # The FILE.d file begins with zero or more option lines, which specify
532 # flags to pass to the assembler, the program to run to dump the
533 # assembler's output, and the options it wants. The option lines have
534 # the syntax:
535 #
536 # # OPTION: VALUE
537 #
538 # OPTION is the name of some option, like "name" or "objdump", and
539 # VALUE is OPTION's value. The valid options are described below.
540 # Whitespace is ignored everywhere, except within VALUE. The option
541 # list ends with the first line that doesn't match the above syntax
542 # (hmm, not great for error detection).
543 #
544 # The interesting options are:
545 #
546 # name: TEST-NAME
547 # The name of this test, passed to DejaGNU's `pass' and `fail'
548 # commands. If omitted, this defaults to FILE, the root of the
549 # .s and .d files' names.
550 #
551 # as: FLAGS
552 # When assembling, pass FLAGS to the assembler.
553 # If assembling several files, you can pass different assembler
554 # options in the "source" directives. See below.
555 #
556 # ld: FLAGS
557 # Link assembled files using FLAGS, in the order of the "source"
558 # directives, when using multiple files.
559 #
560 # objcopy_linked_file: FLAGS
561 # Run objcopy on the linked file with the specified flags.
562 # This lets you transform the linked file using objcopy, before the
563 # result is analyzed by an analyzer program specified below (which
564 # may in turn *also* be objcopy).
565 #
566 # PROG: PROGRAM-NAME
567 # The name of the program to run to analyze the .o file produced
568 # by the assembler or the linker output. This can be omitted;
569 # run_dump_test will guess which program to run by seeing which of
570 # the flags options below is present.
571 #
572 # objdump: FLAGS
573 # nm: FLAGS
574 # objcopy: FLAGS
575 # Use the specified program to analyze the assembler or linker
576 # output file, and pass it FLAGS, in addition to the output name.
577 # Note that they are run with LC_ALL=C in the environment to give
578 # consistent sorting of symbols.
579 #
580 # source: SOURCE [FLAGS]
581 # Assemble the file SOURCE.s using the flags in the "as" directive
582 # and the (optional) FLAGS. If omitted, the source defaults to
583 # FILE.s.
584 # This is useful if several .d files want to share a .s file.
585 # More than one "source" directive can be given, which is useful
586 # when testing linking.
587 #
588 # xfail: TARGET
589 # The test is expected to fail on TARGET. This may occur more than
590 # once.
591 #
592 # target: TARGET
593 # Only run the test for TARGET. This may occur more than once; the
594 # target being tested must match at least one.
595 #
596 # notarget: TARGET
597 # Do not run the test for TARGET. This may occur more than once;
598 # the target being tested must not match any of them.
599 #
600 # error: REGEX
601 # An error with message matching REGEX must be emitted for the test
602 # to pass. The PROG, objdump, nm and objcopy options have no
603 # meaning and need not supplied if this is present.
604 #
605 # warning: REGEX
606 # Expect a linker warning matching REGEX. It is an error to issue
607 # both "error" and "warning".
608 #
609 # Each option may occur at most once unless otherwise mentioned.
610 #
611 # After the option lines come regexp lines. `run_dump_test' calls
612 # `regexp_diff' to compare the output of the dumping tool against the
613 # regexps in FILE.d. `regexp_diff' is defined later in this file; see
614 # further comments there.
615 #
616 proc run_dump_test { name } {
617 global subdir srcdir
618 global OBJDUMP NM AS OBJCOPY READELF LD
619 global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS
620 global host_triplet runtests
621 global env
622
623 if [string match "*/*" $name] {
624 set file $name
625 set name [file tail $name]
626 } else {
627 set file "$srcdir/$subdir/$name"
628 }
629
630 if ![runtest_file_p $runtests $name] then {
631 return
632 }
633
634 set opt_array [slurp_options "${file}.d"]
635 if { $opt_array == -1 } {
636 perror "error reading options from $file.d"
637 unresolved $subdir/$name
638 return
639 }
640 set dumpfile tmpdir/dump.out
641 set run_ld 0
642 set run_objcopy 0
643 set opts(as) {}
644 set opts(ld) {}
645 set opts(xfail) {}
646 set opts(target) {}
647 set opts(notarget) {}
648 set opts(objdump) {}
649 set opts(nm) {}
650 set opts(objcopy) {}
651 set opts(readelf) {}
652 set opts(name) {}
653 set opts(PROG) {}
654 set opts(source) {}
655 set opts(error) {}
656 set opts(warning) {}
657 set opts(objcopy_linked_file) {}
658 set asflags(${file}.s) {}
659
660 foreach i $opt_array {
661 set opt_name [lindex $i 0]
662 set opt_val [lindex $i 1]
663 if ![info exists opts($opt_name)] {
664 perror "unknown option $opt_name in file $file.d"
665 unresolved $subdir/$name
666 return
667 }
668
669 switch -- $opt_name {
670 xfail {}
671 target {}
672 notarget {}
673 source {
674 # Move any source-specific as-flags to a separate array to
675 # simplify processing.
676 if { [llength $opt_val] > 1 } {
677 set asflags([lindex $opt_val 0]) [lrange $opt_val 1 end]
678 set opt_val [lindex $opt_val 0]
679 } else {
680 set asflags($opt_val) {}
681 }
682 }
683 default {
684 if [string length $opts($opt_name)] {
685 perror "option $opt_name multiply set in $file.d"
686 unresolved $subdir/$name
687 return
688 }
689
690 # A single "# ld:" with no options should do the right thing.
691 if { $opt_name == "ld" } {
692 set run_ld 1
693 }
694 # Likewise objcopy_linked_file.
695 if { $opt_name == "objcopy_linked_file" } {
696 set run_objcopy 1
697 }
698 }
699 }
700 if { $opt_name == "as" || $opt_name == "ld" } {
701 set opt_val [subst $opt_val]
702 }
703 set opts($opt_name) [concat $opts($opt_name) $opt_val]
704 }
705 foreach opt { as ld } {
706 regsub {\[big_or_little_endian\]} $opts($opt) \
707 [big_or_little_endian] opts($opt)
708 }
709
710 # Decide early whether we should run the test for this target.
711 if { [llength $opts(target)] > 0 } {
712 set targmatch 0
713 foreach targ $opts(target) {
714 if [istarget $targ] {
715 set targmatch 1
716 break
717 }
718 }
719 if { $targmatch == 0 } {
720 return
721 }
722 }
723 foreach targ $opts(notarget) {
724 if [istarget $targ] {
725 return
726 }
727 }
728
729 set program ""
730 # It's meaningless to require an output-testing method when we
731 # expect an error.
732 if { $opts(error) == "" } {
733 if {$opts(PROG) != ""} {
734 switch -- $opts(PROG) {
735 objdump { set program objdump }
736 nm { set program nm }
737 objcopy { set program objcopy }
738 readelf { set program readelf }
739 default
740 { perror "unrecognized program option $opts(PROG) in $file.d"
741 unresolved $subdir/$name
742 return }
743 }
744 } else {
745 # Guess which program to run, by seeing which option was specified.
746 foreach p {objdump objcopy nm readelf} {
747 if {$opts($p) != ""} {
748 if {$program != ""} {
749 perror "ambiguous dump program in $file.d"
750 unresolved $subdir/$name
751 return
752 } else {
753 set program $p
754 }
755 }
756 }
757 }
758 if { $program == "" && $opts(warning) == "" } {
759 perror "dump program unspecified in $file.d"
760 unresolved $subdir/$name
761 return
762 }
763 }
764
765 if { $opts(name) == "" } {
766 set testname "$subdir/$name"
767 } else {
768 set testname $opts(name)
769 }
770
771 if { $opts(source) == "" } {
772 set sourcefiles [list ${file}.s]
773 } else {
774 set sourcefiles {}
775 foreach sf $opts(source) {
776 if { [string match "/*" $sf] } {
777 lappend sourcefiles "$sf"
778 } else {
779 lappend sourcefiles "$srcdir/$subdir/$sf"
780 }
781 # Must have asflags indexed on source name.
782 set asflags($srcdir/$subdir/$sf) $asflags($sf)
783 }
784 }
785
786 # Time to setup xfailures.
787 foreach targ $opts(xfail) {
788 setup_xfail $targ
789 }
790
791 # Assemble each file.
792 set objfiles {}
793 for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
794 set sourcefile [lindex $sourcefiles $i]
795
796 set objfile "tmpdir/dump$i.o"
797 catch "exec rm -f $objfile" exec_output
798 lappend objfiles $objfile
799 set cmd "$AS $ASFLAGS $opts(as) $asflags($sourcefile) -o $objfile $sourcefile"
800
801 send_log "$cmd\n"
802 set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
803 remote_upload host "ld.tmp"
804 set comp_output [prune_warnings [file_contents "ld.tmp"]]
805 remote_file host delete "ld.tmp"
806 remote_file build delete "ld.tmp"
807
808 if { [lindex $cmdret 0] != 0 || ![string match "" $comp_output] } then {
809 send_log "$comp_output\n"
810 verbose "$comp_output" 3
811
812 set exitstat "succeeded"
813 if { $cmdret != 0 } { set exitstat "failed" }
814 verbose -log "$exitstat with: <$comp_output>"
815 fail $testname
816 return
817 }
818 }
819
820 set expmsg $opts(error)
821 if { $opts(warning) != "" } {
822 if { $expmsg != "" } {
823 perror "$testname: mixing error and warning test-directives"
824 return
825 }
826 set expmsg $opts(warning)
827 }
828
829 # Perhaps link the file(s).
830 if { $run_ld } {
831 set objfile "tmpdir/dump"
832 catch "exec rm -f $objfile" exec_output
833
834 # Add -L$srcdir/$subdir so that the linker command can use
835 # linker scripts in the source directory.
836 set cmd "$LD $LDFLAGS -L$srcdir/$subdir \
837 $opts(ld) -o $objfile $objfiles"
838
839 send_log "$cmd\n"
840 set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
841 remote_upload host "ld.tmp"
842 set comp_output [prune_warnings [file_contents "ld.tmp"]]
843 remote_file host delete "ld.tmp"
844 remote_file build delete "ld.tmp"
845 set cmdret [lindex $cmdret 0]
846
847 if { $cmdret == 0 && $run_objcopy } {
848 set infile $objfile
849 set objfile "tmpdir/dump1"
850 remote_file host delete $objfile
851
852 # Note that we don't use OBJCOPYFLAGS here; any flags must be
853 # explicitly specified.
854 set cmd "$OBJCOPY $opts(objcopy_linked_file) $infile $objfile"
855
856 send_log "$cmd\n"
857 set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
858 remote_upload host "ld.tmp"
859 append comp_output [prune_warnings [file_contents "ld.tmp"]]
860 remote_file host delete "ld.tmp"
861 remote_file build delete "ld.tmp"
862 set cmdret [lindex $cmdret 0]
863 }
864
865 regsub "\n$" $comp_output "" comp_output
866 if { $cmdret != 0 || $comp_output != "" || $expmsg != "" } then {
867 set exitstat "succeeded"
868 if { $cmdret != 0 } { set exitstat "failed" }
869 verbose -log "$exitstat with: <$comp_output>, expected: <$expmsg>"
870 send_log "$comp_output\n"
871 verbose "$comp_output" 3
872
873 if { [regexp $expmsg $comp_output] \
874 && (($cmdret == 0) == ($opts(warning) != "")) } {
875 # We have the expected output from ld.
876 if { $opts(error) != "" || $program == "" } {
877 pass $testname
878 return
879 }
880 } else {
881 verbose -log "$exitstat with: <$comp_output>, expected: <$expmsg>"
882 fail $testname
883 return
884 }
885 }
886 } else {
887 set objfile "tmpdir/dump0.o"
888 }
889
890 # We must not have expected failure if we get here.
891 if { $opts(error) != "" } {
892 fail $testname
893 return
894 }
895
896 set progopts1 $opts($program)
897 eval set progopts \$[string toupper $program]FLAGS
898 eval set binary \$[string toupper $program]
899
900 if { ![is_remote host] && [which $binary] == 0 } {
901 untested $testname
902 return
903 }
904
905 if { $progopts1 == "" } { set $progopts1 "-r" }
906 verbose "running $binary $progopts $progopts1" 3
907
908 # Objcopy, unlike the other two, won't send its output to stdout,
909 # so we have to run it specially.
910 set cmd "$binary $progopts $progopts1 $objfile > $dumpfile"
911 if { $program == "objcopy" } {
912 set cmd "$binary $progopts $progopts1 $objfile $dumpfile"
913 }
914
915 # Ensure consistent sorting of symbols
916 if {[info exists env(LC_ALL)]} {
917 set old_lc_all $env(LC_ALL)
918 }
919 set env(LC_ALL) "C"
920 send_log "$cmd\n"
921 set cmdret [remote_exec host [concat sh -c [list "$cmd 2>ld.tmp"]] "" "/dev/null"]
922 remote_upload host "ld.tmp"
923 set comp_output [prune_warnings [file_contents "ld.tmp"]]
924 remote_file host delete "ld.tmp"
925 remote_file build delete "ld.tmp"
926 if {[info exists old_lc_all]} {
927 set env(LC_ALL) $old_lc_all
928 } else {
929 unset env(LC_ALL)
930 }
931 if ![string match "" $comp_output] then {
932 send_log "$comp_output\n"
933 fail $testname
934 return
935 }
936
937 verbose_eval {[file_contents $dumpfile]} 3
938 if { [regexp_diff $dumpfile "${file}.d"] } then {
939 fail $testname
940 verbose "output is [file_contents $dumpfile]" 2
941 return
942 }
943
944 pass $testname
945 }
946
947 proc slurp_options { file } {
948 if [catch { set f [open $file r] } x] {
949 #perror "couldn't open `$file': $x"
950 perror "$x"
951 return -1
952 }
953 set opt_array {}
954 # whitespace expression
955 set ws {[ ]*}
956 set nws {[^ ]*}
957 # whitespace is ignored anywhere except within the options list;
958 # option names are alphabetic plus underscore only.
959 set pat "^#${ws}(\[a-zA-Z_\]*)$ws:${ws}(.*)$ws\$"
960 while { [gets $f line] != -1 } {
961 set line [string trim $line]
962 # Whitespace here is space-tab.
963 if [regexp $pat $line xxx opt_name opt_val] {
964 # match!
965 lappend opt_array [list $opt_name $opt_val]
966 } else {
967 break
968 }
969 }
970 close $f
971 return $opt_array
972 }
973
974 # regexp_diff, copied from gas, based on simple_diff above.
975 # compares two files line-by-line
976 # file1 contains strings, file2 contains regexps and #-comments
977 # blank lines are ignored in either file
978 # returns non-zero if differences exist
979 #
980 proc regexp_diff { file_1 file_2 } {
981
982 set eof -1
983 set end_1 0
984 set end_2 0
985 set differences 0
986 set diff_pass 0
987
988 if [file exists $file_1] then {
989 set file_a [open $file_1 r]
990 } else {
991 warning "$file_1 doesn't exist"
992 return 1
993 }
994
995 if [file exists $file_2] then {
996 set file_b [open $file_2 r]
997 } else {
998 fail "$file_2 doesn't exist"
999 close $file_a
1000 return 1
1001 }
1002
1003 verbose " Regexp-diff'ing: $file_1 $file_2" 2
1004
1005 while { 1 } {
1006 set line_a ""
1007 set line_b ""
1008 while { [string length $line_a] == 0 } {
1009 if { [gets $file_a line_a] == $eof } {
1010 set end_1 1
1011 break
1012 }
1013 }
1014 while { [string length $line_b] == 0 || [string match "#*" $line_b] } {
1015 if [ string match "#pass" $line_b ] {
1016 set end_2 1
1017 set diff_pass 1
1018 break
1019 } elseif [ string match "#..." $line_b ] {
1020 if { [gets $file_b line_b] == $eof } {
1021 set end_2 1
1022 set diff_pass 1
1023 break
1024 }
1025 verbose "looking for \"^$line_b$\"" 3
1026 while { ![regexp "^$line_b$" "$line_a"] } {
1027 verbose "skipping \"$line_a\"" 3
1028 if { [gets $file_a line_a] == $eof } {
1029 set end_1 1
1030 break
1031 }
1032 }
1033 break
1034 }
1035 if { [gets $file_b line_b] == $eof } {
1036 set end_2 1
1037 break
1038 }
1039 }
1040
1041 if { $diff_pass } {
1042 break
1043 } elseif { $end_1 && $end_2 } {
1044 break
1045 } elseif { $end_1 } {
1046 send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n"
1047 verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3
1048 set differences 1
1049 break
1050 } elseif { $end_2 } {
1051 send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n"
1052 verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3
1053 set differences 1
1054 break
1055 } else {
1056 verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3
1057 if ![regexp "^$line_b$" "$line_a"] {
1058 send_log "regexp_diff match failure\n"
1059 send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n"
1060 set differences 1
1061 }
1062 }
1063 }
1064
1065 if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } {
1066 send_log "$file_1 and $file_2 are different lengths\n"
1067 verbose "$file_1 and $file_2 are different lengths" 3
1068 set differences 1
1069 }
1070
1071 close $file_a
1072 close $file_b
1073
1074 return $differences
1075 }
1076
1077 proc file_contents { filename } {
1078 set file [open $filename r]
1079 set contents [read $file]
1080 close $file
1081 return $contents
1082 }
1083
1084 # List contains test-items with 3 items followed by 2 lists, one item and
1085 # one optional item:
1086 # 0:name 1:ld options 2:assembler options
1087 # 3:filenames of assembler files 4: action and options. 5: name of output file
1088 # 6:compiler flags (optional)
1089 #
1090 # Actions:
1091 # objdump: Apply objdump options on result. Compare with regex (last arg).
1092 # nm: Apply nm options on result. Compare with regex (last arg).
1093 # readelf: Apply readelf options on result. Compare with regex (last arg).
1094 #
1095 proc run_ld_link_tests { ldtests } {
1096 global ld
1097 global as
1098 global nm
1099 global objdump
1100 global READELF
1101 global srcdir
1102 global subdir
1103 global env
1104 global CC
1105 global CFLAGS
1106
1107 foreach testitem $ldtests {
1108 set testname [lindex $testitem 0]
1109 set ld_options [lindex $testitem 1]
1110 set as_options [lindex $testitem 2]
1111 set src_files [lindex $testitem 3]
1112 set actions [lindex $testitem 4]
1113 set binfile tmpdir/[lindex $testitem 5]
1114 set cflags [lindex $testitem 6]
1115 set objfiles {}
1116 set is_unresolved 0
1117 set failed 0
1118
1119 # verbose -log "Testname is $testname"
1120 # verbose -log "ld_options is $ld_options"
1121 # verbose -log "as_options is $as_options"
1122 # verbose -log "src_files is $src_files"
1123 # verbose -log "actions is $actions"
1124 # verbose -log "binfile is $binfile"
1125
1126 # Assemble each file in the test.
1127 foreach src_file $src_files {
1128 set objfile "tmpdir/[file rootname $src_file].o"
1129 lappend objfiles $objfile
1130
1131 if { [file extension $src_file] == ".c" } {
1132 set as_file "tmpdir/[file rootname $src_file].s"
1133 if ![ld_compile "$CC -S $CFLAGS $cflags" $srcdir/$subdir/$src_file $as_file] {
1134 set is_unresolved 1
1135 break
1136 }
1137 } else {
1138 set as_file "$srcdir/$subdir/$src_file"
1139 }
1140 if ![ld_assemble $as "$as_options $as_file" $objfile] {
1141 set is_unresolved 1
1142 break
1143 }
1144 }
1145
1146 # Catch assembler errors.
1147 if { $is_unresolved != 0 } {
1148 unresolved $testname
1149 continue
1150 }
1151
1152 if ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
1153 fail $testname
1154 } else {
1155 set failed 0
1156 foreach actionlist $actions {
1157 set action [lindex $actionlist 0]
1158 set progopts [lindex $actionlist 1]
1159
1160 # There are actions where we run regexp_diff on the
1161 # output, and there are other actions (presumably).
1162 # Handling of the former look the same.
1163 set dump_prog ""
1164 switch -- $action {
1165 objdump
1166 { set dump_prog $objdump }
1167 nm
1168 { set dump_prog $nm }
1169 readelf
1170 { set dump_prog $READELF }
1171 default
1172 {
1173 perror "Unrecognized action $action"
1174 set is_unresolved 1
1175 break
1176 }
1177 }
1178
1179 if { $dump_prog != "" } {
1180 set dumpfile [lindex $actionlist 2]
1181 set binary $dump_prog
1182
1183 # Ensure consistent sorting of symbols
1184 if {[info exists env(LC_ALL)]} {
1185 set old_lc_all $env(LC_ALL)
1186 }
1187 set env(LC_ALL) "C"
1188 set cmd "$binary $progopts $binfile"
1189 set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
1190 send_log "$cmd\n"
1191 remote_upload host "ld.stderr"
1192 set comp_output [prune_warnings [file_contents "ld.stderr"]]
1193 remote_file host delete "ld.stderr"
1194 remote_file build delete "ld.stderr"
1195
1196 if {[info exists old_lc_all]} {
1197 set env(LC_ALL) $old_lc_all
1198 } else {
1199 unset env(LC_ALL)
1200 }
1201
1202 if ![string match "" $comp_output] then {
1203 send_log "$comp_output\n"
1204 set failed 1
1205 break
1206 }
1207
1208 remote_upload host "dump.out"
1209
1210 if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
1211 verbose "output is [file_contents "dump.out"]" 2
1212 set failed 1
1213 remote_file build delete "dump.out"
1214 remote_file host delete "dump.out"
1215 break
1216 }
1217 remote_file build delete "dump.out"
1218 remote_file host delete "dump.out"
1219 }
1220 }
1221
1222 if { $failed != 0 } {
1223 fail $testname
1224 } else { if { $is_unresolved == 0 } {
1225 pass $testname
1226 } }
1227 }
1228
1229 # Catch action errors.
1230 if { $is_unresolved != 0 } {
1231 unresolved $testname
1232 continue
1233 }
1234 }
1235 }
1236
1237
1238 proc verbose_eval { expr { level 1 } } {
1239 global verbose
1240 if $verbose>$level then { eval verbose "$expr" $level }
1241 }
1242
1243 # This definition is taken from an unreleased version of DejaGnu. Once
1244 # that version gets released, and has been out in the world for a few
1245 # months at least, it may be safe to delete this copy.
1246 if ![string length [info proc prune_warnings]] {
1247 #
1248 # prune_warnings -- delete various system verbosities from TEXT
1249 #
1250 # An example is:
1251 # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
1252 #
1253 # Sites with particular verbose os's may wish to override this in site.exp.
1254 #
1255 proc prune_warnings { text } {
1256 # This is from sun4's. Do it for all machines for now.
1257 # The "\\1" is to try to preserve a "\n" but only if necessary.
1258 regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
1259
1260 # It might be tempting to get carried away and delete blank lines, etc.
1261 # Just delete *exactly* what we're ask to, and that's it.
1262 return $text
1263 }
1264 }
1265
1266 # targets_to_xfail is a list of target triplets to be xfailed.
1267 # ldtests contains test-items with 3 items followed by 1 lists, 2 items
1268 # and 3 optional items:
1269 # 0:name
1270 # 1:ld options
1271 # 2:assembler options
1272 # 3:filenames of source files
1273 # 4:name of output file
1274 # 5:expected output
1275 # 6:compiler flags (optional)
1276 # 7:language (optional)
1277 # 8:linker warning (optional)
1278
1279 proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
1280 global ld
1281 global as
1282 global srcdir
1283 global subdir
1284 global env
1285 global CC
1286 global CXX
1287 global CFLAGS
1288 global errcnt
1289 global exec_output
1290
1291 foreach testitem $ldtests {
1292 foreach target $targets_to_xfail {
1293 setup_xfail $target
1294 }
1295 set testname [lindex $testitem 0]
1296 set ld_options [lindex $testitem 1]
1297 set as_options [lindex $testitem 2]
1298 set src_files [lindex $testitem 3]
1299 set binfile tmpdir/[lindex $testitem 4]
1300 set expfile [lindex $testitem 5]
1301 set cflags [lindex $testitem 6]
1302 set lang [lindex $testitem 7]
1303 set warning [lindex $testitem 8]
1304 set objfiles {}
1305 set failed 0
1306
1307 # verbose -log "Testname is $testname"
1308 # verbose -log "ld_options is $ld_options"
1309 # verbose -log "as_options is $as_options"
1310 # verbose -log "src_files is $src_files"
1311 # verbose -log "actions is $actions"
1312 # verbose -log "binfile is $binfile"
1313
1314 # Assemble each file in the test.
1315 foreach src_file $src_files {
1316 set objfile "tmpdir/[file rootname $src_file].o"
1317 lappend objfiles $objfile
1318
1319 # We ignore warnings since some compilers may generate
1320 # incorrect section attributes and the assembler will warn
1321 # them.
1322 ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
1323
1324 # We have to use $CC to build PIE and shared library.
1325 if { [ string match "c" $lang ] } {
1326 set link_proc ld_simple_link
1327 set link_cmd $CC
1328 } elseif { [ string match "c++" $lang ] } {
1329 set link_proc ld_simple_link
1330 set link_cmd $CXX
1331 } elseif { [ string match "-shared" $ld_options ] \
1332 || [ string match "-pie" $ld_options ] } {
1333 set link_proc ld_simple_link
1334 set link_cmd $CC
1335 } else {
1336 set link_proc ld_link
1337 set link_cmd $ld
1338 }
1339
1340 if ![$link_proc $link_cmd $binfile "-L$srcdir/$subdir $ld_options $objfiles"] {
1341 set failed 1
1342 } else {
1343 set failed 0
1344 }
1345
1346 # Check if exec_output is expected.
1347 if { $warning != "" } then {
1348 verbose -log "returned with: <$exec_output>, expected: <$warning>"
1349 if { [regexp $warning $exec_output] } then {
1350 set failed 0
1351 } else {
1352 set failed 1
1353 }
1354 }
1355
1356 if { $failed == 0 } {
1357 send_log "Running: $binfile > $binfile.out\n"
1358 verbose "Running: $binfile > $binfile.out"
1359 catch "exec $binfile > $binfile.out" exec_output
1360
1361 if ![string match "" $exec_output] then {
1362 send_log "$exec_output\n"
1363 verbose "$exec_output" 1
1364 set failed 1
1365 } else {
1366 send_log "diff $binfile.out $srcdir/$subdir/$expfile\n"
1367 verbose "diff $binfile.out $srcdir/$subdir/$expfile"
1368 catch "exec diff $binfile.out $srcdir/$subdir/$expfile" exec_output
1369 set exec_output [prune_warnings $exec_output]
1370
1371 if ![string match "" $exec_output] then {
1372 send_log "$exec_output\n"
1373 verbose "$exec_output" 1
1374 set failed 1
1375 }
1376 }
1377 }
1378
1379 if { $failed != 0 } {
1380 fail $testname
1381 } else {
1382 set errcnt 0
1383 pass $testname
1384 }
1385 }
1386 }
1387 }
1388
1389 # List contains test-items with 3 items followed by 2 lists, one item and
1390 # one optional item:
1391 # 0:name
1392 # 1:link options
1393 # 2:compile options
1394 # 3:filenames of source files
1395 # 4:action and options.
1396 # 5:name of output file
1397 # 6:language (optional)
1398 #
1399 # Actions:
1400 # objdump: Apply objdump options on result. Compare with regex (last arg).
1401 # nm: Apply nm options on result. Compare with regex (last arg).
1402 # readelf: Apply readelf options on result. Compare with regex (last arg).
1403 #
1404 proc run_cc_link_tests { ldtests } {
1405 global nm
1406 global objdump
1407 global READELF
1408 global srcdir
1409 global subdir
1410 global env
1411 global CC
1412 global CXX
1413 global CFLAGS
1414
1415 foreach testitem $ldtests {
1416 set testname [lindex $testitem 0]
1417 set ldflags [lindex $testitem 1]
1418 set cflags [lindex $testitem 2]
1419 set src_files [lindex $testitem 3]
1420 set actions [lindex $testitem 4]
1421 set binfile tmpdir/[lindex $testitem 5]
1422 set lang [lindex $testitem 6]
1423 set objfiles {}
1424 set is_unresolved 0
1425 set failed 0
1426
1427 # Compile each file in the test.
1428 foreach src_file $src_files {
1429 set objfile "tmpdir/[file rootname $src_file].o"
1430 lappend objfiles $objfile
1431
1432 # We ignore warnings since some compilers may generate
1433 # incorrect section attributes and the assembler will warn
1434 # them.
1435 ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
1436 }
1437
1438 # Clear error and warning counts.
1439 reset_vars
1440
1441 if { [ string match "c++" $lang ] } {
1442 set cc_cmd $CXX
1443 } else {
1444 set cc_cmd $CC
1445 }
1446
1447 if ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] {
1448 fail $testname
1449 } else {
1450 set failed 0
1451 foreach actionlist $actions {
1452 set action [lindex $actionlist 0]
1453 set progopts [lindex $actionlist 1]
1454
1455 # There are actions where we run regexp_diff on the
1456 # output, and there are other actions (presumably).
1457 # Handling of the former look the same.
1458 set dump_prog ""
1459 switch -- $action {
1460 objdump
1461 { set dump_prog $objdump }
1462 nm
1463 { set dump_prog $nm }
1464 readelf
1465 { set dump_prog $READELF }
1466 default
1467 {
1468 perror "Unrecognized action $action"
1469 set is_unresolved 1
1470 break
1471 }
1472 }
1473
1474 if { $dump_prog != "" } {
1475 set dumpfile [lindex $actionlist 2]
1476 set binary $dump_prog
1477
1478 # Ensure consistent sorting of symbols
1479 if {[info exists env(LC_ALL)]} {
1480 set old_lc_all $env(LC_ALL)
1481 }
1482 set env(LC_ALL) "C"
1483 set cmd "$binary $progopts $binfile > dump.out"
1484 send_log "$cmd\n"
1485 catch "exec $cmd" comp_output
1486 if {[info exists old_lc_all]} {
1487 set env(LC_ALL) $old_lc_all
1488 } else {
1489 unset env(LC_ALL)
1490 }
1491 set comp_output [prune_warnings $comp_output]
1492
1493 if ![string match "" $comp_output] then {
1494 send_log "$comp_output\n"
1495 set failed 1
1496 break
1497 }
1498
1499 if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
1500 verbose "output is [file_contents "dump.out"]" 2
1501 set failed 1
1502 break
1503 }
1504 }
1505 }
1506
1507 if { $failed != 0 } {
1508 fail $testname
1509 } else { if { $is_unresolved == 0 } {
1510 pass $testname
1511 } }
1512 }
1513
1514 # Catch action errors.
1515 if { $is_unresolved != 0 } {
1516 unresolved $testname
1517 continue
1518 }
1519 }
1520 }
This page took 0.067438 seconds and 5 git commands to generate.