wgengine/magicsock: move device close to uncursed portion of test.
Device close used to suffer from deadlocks, but no longer.
@@ -389,6 +389,7 @@ func TestTwoDevicePing(t *testing.T) {
if err := dev1.Reconfig(&cfgs[0]); err != nil {
t.Fatal(err)
}
+ defer dev1.Close()
tun2 := tuntest.NewChannelTUN()
dev2 := device.NewDevice(tun2.TUN(), &device.DeviceOptions{
@@ -398,6 +399,7 @@ func TestTwoDevicePing(t *testing.T) {
SkipBindUpdate: true,
})
dev2.Up()
+ defer dev2.Close()
if err := dev2.Reconfig(&cfgs[1]); err != nil {
t.Fatal(err)
@@ -460,8 +462,6 @@ func TestTwoDevicePing(t *testing.T) {
if os.Getenv("RUN_CURSED_TESTS") == "" {
t.Skip("test is very broken, don't run in CI until it's reliable.")
}
- defer dev1.Close() // TODO(crawshaw): this hangs
- defer dev2.Close() // TODO(crawshaw): this hangs
pingSeq := func(t *testing.T, count int, totalTime time.Duration, strict bool) {
msg := func(i int) []byte {
