Skip to content

Commit 02e4c91

Browse files
committed
cgotest: don't immediately fail test on sub-test failure
In testSysconfGoCgo and testSysconfGoCgoInvalid use t.Errorf and return instead of t.Fatalf so successive sub-tests are still executed.
1 parent 9c064e6 commit 02e4c91

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cgotest/sysconf_cgotest.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ func testSysconfGoCgo(t *testing.T, tc testCase) {
3333

3434
goVal, goErr := sysconf.Sysconf(tc.goVar)
3535
if goErr != nil {
36-
t.Fatalf("Sysconf(%s/%d): %v", tc.name, tc.goVar, goErr)
36+
t.Errorf("Sysconf(%s/%d): %v", tc.name, tc.goVar, goErr)
37+
return
3738
}
3839
t.Logf("%s = %v", tc.name, goVal)
3940

4041
cVal, cErr := C.sysconf(tc.cVar)
4142
if cErr != nil {
42-
t.Fatalf("C.sysconf(%s/%d): %v", tc.name, tc.cVar, cErr)
43+
t.Errorf("C.sysconf(%s/%d): %v", tc.name, tc.cVar, cErr)
44+
return
4345
}
4446

4547
if goVal != int64(cVal) {
@@ -56,11 +58,12 @@ func testSysconfGoCgoInvalid(t *testing.T, tc testCase) {
5658

5759
_, goErr := sysconf.Sysconf(tc.goVar)
5860
if goErr == nil {
59-
t.Fatalf("Sysconf(%s/%d) unexpectedly returned without error", tc.name, tc.goVar)
61+
t.Errorf("Sysconf(%s/%d) unexpectedly returned without error", tc.name, tc.goVar)
62+
return
6063
}
6164

6265
_, cErr := C.sysconf(tc.cVar)
6366
if cErr == nil {
64-
t.Fatalf("C.sysconf(%s/%d) unexpectedly returned without error", tc.name, tc.goVar)
67+
t.Errorf("C.sysconf(%s/%d) unexpectedly returned without error", tc.name, tc.goVar)
6568
}
6669
}

0 commit comments

Comments
 (0)