@@ -6,16 +6,16 @@ using Test
6
6
mktempdir () do dir
7
7
fpath = joinpath (dir, " empty" )
8
8
touch (fpath)
9
- @test_throws MagicMismatch readmeta (fpath) do oh
9
+ @test_throws MagicMismatch readmeta (fpath) do ohs
10
10
@test false
11
11
end
12
12
end
13
13
end
14
14
15
15
function test_libfoo_and_fooifier (fooifier_path, libfoo_path)
16
16
# Actually read it in
17
- oh_exe = readmeta (open (fooifier_path, " r" ))
18
- oh_lib = readmeta (open (libfoo_path, " r" ))
17
+ oh_exe = only ( readmeta (open (fooifier_path, " r" ) ))
18
+ oh_lib = only ( readmeta (open (libfoo_path, " r" ) ))
19
19
20
20
# Tease out some information from the containing folder name
21
21
dir_path = basename (dirname (libfoo_path))
@@ -158,28 +158,31 @@ function test_libfoo_and_fooifier(fooifier_path, libfoo_path)
158
158
end
159
159
160
160
function test_fat_libfoo (file)
161
- oh = readmeta (open (file, " r" ))
162
- @test isa (oh, FatMachOHandle)
163
- local (ntotal, n64) = (0 , 0 )
164
- for coh in oh
161
+ ohs = readmeta (open (file, " r" ))
162
+ @test isa (ohs, FatMachOHandle)
163
+ @test length (ohs) == 2
164
+ ntotal, n64 = 0 , 0
165
+ for oh in ohs
165
166
ntotal += 1
166
- n64 += is64bit (coh )
167
+ n64 += is64bit (oh )
167
168
end
168
169
@test ntotal == 2
169
170
@test n64 == 1
170
171
end
171
172
172
173
function test_metal (file)
173
- oh = readmeta (open (file, " r" ))
174
- @test isa (oh , FatMachOHandle)
175
- @test length (oh ) == 2
174
+ ohs = readmeta (open (file, " r" ))
175
+ @test isa (ohs , FatMachOHandle)
176
+ @test length (ohs ) == 2
176
177
177
- arch = oh[1 ]
178
- @test arch. header isa MachO. MachOHeader64
179
- @test findfirst (Sections (arch), " __TEXT,__compute" ) != = nothing
178
+ let oh = ohs[1 ]
179
+ @test oh. header isa MachO. MachOHeader64
180
+ @test findfirst (Sections (oh), " __TEXT,__compute" ) != = nothing
181
+ end
180
182
181
- arch = oh[2 ]
182
- @test arch. header isa MachO. MetallibHeader
183
+ let oh = ohs[2 ]
184
+ @test oh. header isa MachO. MetallibHeader
185
+ end
183
186
end
184
187
185
188
# Run ELF tests
@@ -202,7 +205,8 @@ test_libfoo_and_fooifier("./win64/fooifier.exe", "./win64/libfoo.dll")
202
205
203
206
# Extract all pieces of `.gnu.version_d` from libstdc++.so, find the `GLIBCXX_*`
204
207
# symbols, and use the maximum version of that to find the GLIBCXX ABI version number
205
- version_symbols = readmeta (libstdcxx_path) do oh
208
+ version_symbols = readmeta (libstdcxx_path) do ohs
209
+ oh = only (ohs)
206
210
unique (vcat ((x -> x. names). (ObjectFile. ELF. ELFVersionData (oh)). .. ))
207
211
end
208
212
version_symbols = filter (x -> startswith (x, " GLIBCXX_" ), version_symbols)
216
220
# Test that 6a66694a8dd5ca85bd96fe6236f21d5b183e7de6 fix worked
217
221
libmsobj_path = " ./win32/msobj140.dll"
218
222
219
- dynamic_links = readmeta (libmsobj_path) do oh
223
+ dynamic_links = readmeta (libmsobj_path) do ohs
224
+ oh = only (ohs)
220
225
path .(DynamicLinks (oh))
221
226
end
222
227
226
231
@test " api-ms-win-crt-runtime-l1-1-0.dll" in dynamic_links
227
232
228
233
whouses_exe = " ./win32/WhoUses.exe"
229
- dynamic_links = readmeta (whouses_exe) do oh
234
+ dynamic_links = readmeta (whouses_exe) do ohs
235
+ oh = only (ohs)
230
236
path .(DynamicLinks (oh))
231
237
end
232
238
0 commit comments