Skip to content

Commit 35483c8

Browse files
committed
misc/cgo/testcshared: delete testp0.exe not testp0 file
Otherwise we end up with testp?.exe files after the tests run. Updates #11058 Change-Id: Ieccfc42da6192622bdab1f9a411ccd50bb59fd5b Reviewed-on: https://go-review.googlesource.com/68770 Run-TryBot: Alex Brainman <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent f7ad3a0 commit 35483c8

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

misc/cgo/testcshared/cshared_test.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,16 @@ func TestExportedSymbols(t *testing.T) {
280280
t.Parallel()
281281

282282
cmd := "testp0"
283+
bin := cmdToRun(cmd)
283284

284285
createHeadersOnce(t)
285286

286287
runCC(t, "-I", installdir, "-o", cmd, "main0.c", libgoname)
287288
adbPush(t, cmd)
288289

289-
defer os.Remove(cmd)
290+
defer os.Remove(bin)
290291

291-
out := runExe(t, append(gopathEnv, "LD_LIBRARY_PATH=."), cmdToRun(cmd))
292+
out := runExe(t, append(gopathEnv, "LD_LIBRARY_PATH=."), bin)
292293
if strings.TrimSpace(out) != "PASS" {
293294
t.Error(out)
294295
}
@@ -304,15 +305,16 @@ func TestExportedSymbolsWithDynamicLoad(t *testing.T) {
304305
}
305306

306307
cmd := "testp1"
308+
bin := cmdToRun(cmd)
307309

308310
createHeadersOnce(t)
309311

310312
runCC(t, "-o", cmd, "main1.c", "-ldl")
311313
adbPush(t, cmd)
312314

313-
defer os.Remove(cmd)
315+
defer os.Remove(bin)
314316

315-
out := runExe(t, nil, cmdToRun(cmd), "./"+libgoname)
317+
out := runExe(t, nil, bin, "./"+libgoname)
316318
if strings.TrimSpace(out) != "PASS" {
317319
t.Error(out)
318320
}
@@ -328,6 +330,7 @@ func TestUnexportedSymbols(t *testing.T) {
328330
}
329331

330332
cmd := "testp2"
333+
bin := cmdToRun(cmd)
331334
libname := "libgo2." + libSuffix
332335

333336
run(t,
@@ -348,9 +351,9 @@ func TestUnexportedSymbols(t *testing.T) {
348351
adbPush(t, cmd)
349352

350353
defer os.Remove(libname)
351-
defer os.Remove(cmd)
354+
defer os.Remove(bin)
352355

353-
out := runExe(t, append(gopathEnv, "LD_LIBRARY_PATH=."), cmdToRun(cmd))
356+
out := runExe(t, append(gopathEnv, "LD_LIBRARY_PATH=."), bin)
354357

355358
if strings.TrimSpace(out) != "PASS" {
356359
t.Error(out)
@@ -370,15 +373,16 @@ func TestMainExportedOnAndroid(t *testing.T) {
370373
}
371374

372375
cmd := "testp3"
376+
bin := cmdToRun(cmd)
373377

374378
createHeadersOnce(t)
375379

376380
runCC(t, "-o", cmd, "main3.c", "-ldl")
377381
adbPush(t, cmd)
378382

379-
defer os.Remove(cmd)
383+
defer os.Remove(bin)
380384

381-
out := runExe(t, nil, cmdToRun(cmd), "./"+libgoname)
385+
out := runExe(t, nil, bin, "./"+libgoname)
382386
if strings.TrimSpace(out) != "PASS" {
383387
t.Error(out)
384388
}
@@ -397,11 +401,12 @@ func testSignalHandlers(t *testing.T, pkgname, cfile, cmd string) {
397401
runCC(t, "-pthread", "-o", cmd, cfile, "-ldl")
398402
adbPush(t, cmd)
399403

404+
bin := cmdToRun(cmd)
405+
400406
defer os.Remove(libname)
401-
defer os.Remove(cmd)
407+
defer os.Remove(bin)
402408
defer os.Remove(pkgname + ".h")
403409

404-
bin := cmdToRun(cmd)
405410
out := runExe(t, nil, bin, "./"+libname)
406411
if strings.TrimSpace(out) != "PASS" {
407412
t.Error(run(t, nil, bin, libname, "verbose"))

0 commit comments

Comments
 (0)