mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-02 16:01:27 +01:00
Linux kernel versions 6.6.102-104 and 6.12.42-45 have a regression in /proc/net/tcp that causes seek operations to fail with "illegal seek". This breaks portlist tests on these kernels. Add kernel version detection for Linux systems and a SkipOnKernelVersions helper to tstest. Use it to skip affected portlist tests on the broken kernel versions. Thanks to philiptaron for the list of kernels with the issue and fix. Updates #16966 Signed-off-by: Andrew Dunham <andrew@tailscale.com>
42 lines
857 B
Go
42 lines
857 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package tstest
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func TestReplace(t *testing.T) {
|
|
before := "before"
|
|
done := false
|
|
t.Run("replace", func(t *testing.T) {
|
|
Replace(t, &before, "after")
|
|
if before != "after" {
|
|
t.Errorf("before = %q; want %q", before, "after")
|
|
}
|
|
done = true
|
|
})
|
|
if !done {
|
|
t.Fatal("subtest didn't run")
|
|
}
|
|
if before != "before" {
|
|
t.Errorf("before = %q; want %q", before, "before")
|
|
}
|
|
}
|
|
|
|
func TestKernelVersion(t *testing.T) {
|
|
switch runtime.GOOS {
|
|
case "linux":
|
|
default:
|
|
t.Skipf("skipping test on %s", runtime.GOOS)
|
|
}
|
|
|
|
major, minor, patch := KernelVersion()
|
|
if major == 0 && minor == 0 && patch == 0 {
|
|
t.Fatal("KernelVersion returned (0, 0, 0); expected valid version")
|
|
}
|
|
t.Logf("Kernel version: %d.%d.%d", major, minor, patch)
|
|
}
|