summaryrefslogtreecommitdiffstats
path: root/testsuite/dwz.tests/dwz-tests.exp
blob: 811767f5791882f8ff7bb7e0f5235829b0016ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
set tests [find $srcdir/$subdir *.sh]

set pwd [pwd]

set env(PATH) $srcdir/scripts:$::env(PATH)
set env(execs) $pwd

exec mkdir -p $pwd/testsuite/dwz.tests/execs
exec $srcdir/scripts/xunzip-dir.sh \
    $srcdir/dwz.tests/execs.xz \
    $pwd/testsuite/dwz.tests/execs

foreach test $tests {
    global runtests

    set basename [exec basename $test]

    if ![runtest_file_p $runtests $basename] {
	continue
    }

    set required_execs []
    if { $basename == "pr24173.sh" } {
	lappend required_execs "py-section-script"
    }
    if { $basename == "pr24341.sh" } {
	if { [catch {exec readelf -wi min | grep DW_AT_name | grep -c / } matches] } {
	    # Some error occurred in the supported test, f.i. DWARF in min
	    # unsupported by readelf.
	    unsupported "$test"
	    continue
	}
	if { $matches != 2 } {
	    # The exec min is used for the regression test for pr24341, but it
	    # only functions as such if the DWARF only contains the CUs of the
	    # test-case itself.
	    unsupported "$test"
	    continue
	}
    }
    if { $basename == "pr24172.sh" } {
	if { ![istarget x86_64-*-*] } {
	    unsupported "$test"
	    continue
	}
	lappend required_execs "dw2-skip-prologue"
    }
    if { $basename == "pr24170.sh" } {
	lappend required_execs "implptr-64bit-d2o4a8r8t0"
    }
    if { $basename == "gold-gdb-index.sh" } {
	lappend required_execs "hello-gold-gdb-index"
    }
    if { $basename == "pr24747.sh" } {
	lappend required_execs "start-gold"
    }
    if { $basename == "pr24771.sh" } {
	lappend required_execs "hello-gnu-pubnames"
    }
    if { $basename == "pr24823.sh" } {
	lappend required_execs "varval"
    }
    if { ![istarget x86_64-*-*] } {
	if { $basename == "pr24468.sh" } {
	    unsupported "$test"
	    continue
	}
	if { $basename == "ld-2.26.1-multifile.sh" } {
	    unsupported "$test"
	    continue
	}
    }
    if { $basename == "gdb-add-index.sh" } {
        if { [catch { exec which gdb-add-index } ] } {
            unsupported "$test"
            continue
        }
    }
    if { [istarget mips*-*-*] } {
	# elfutils don't have a MIPS backend (PR elfutils/24795), so eu-strip
	# doesn't work as expected.
	if { $basename == "eu-strip-unstrip.sh" || \
		 $basename == "eu-strip-unstrip-multifile.sh" || \
		 $basename == "pr24173.sh" } {
	    unsupported "$test"
	    continue
	}
    }
    if { $basename == "pr25109.sh" } {
	lappend required_execs no-multifile-prop
    }
    if { $basename == "pr27463.sh" } {
	lappend required_execs unavailable-dwarf-piece
    }

    set unsupported 0
    foreach required_exec $required_execs {
	set exists [file exists $required_exec]
	if { $exists == 0 } {
	    set unsupported 1
	    break
	}
	set size [file size $required_exec]
	if { $size == 0 } {
	    set unsupported 1
	    break
	}
    }
    if { $unsupported == 1 } {
	unsupported "$test"
	continue
    }

    set dir $pwd/tmp.$basename
    exec rm -Rf $dir
    exec mkdir $dir

    cd $dir
    if { [catch { exec sh -e $test } msg] } {
	if { [lindex $::errorCode 0] == "CHILDSTATUS" && \
		 [lindex $::errorCode 2] == 77 } {
	    unsupported "$test"
	    exec rm -Rf $dir
	} else {
	    puts "$msg"
	    fail "$test"
	}
    } else {
	if { [file exists dwz.info ] } {
	    set info [exec cat dwz.info]
	    verbose -log "$test:" 1
	    verbose -log "$info" 1
	    exec rm -f dwz.info
	}
	set file_list [glob -nocomplain "$dir/*"]
	if {[llength $file_list] != 0} {
	    puts "$dir is not empty"
	    fail "$test"
	} else {
	    pass "$test"
	    exec rm -Rf $dir
	}
    }
    cd $pwd
}