Skip to content

Improve big-endian testing #278

Description

@dswarbrick

Yet another test failure on s390x / big-endian hosts:

$ go test -v -count 1 -run TestNlmsgFprintf ./...
=== RUN   TestNlmsgFprintf
=== RUN   TestNlmsgFprintf/nft_add_table_ip_nat
--- FAIL: TestNlmsgFprintf (0.00s)
    --- FAIL: TestNlmsgFprintf/nft_add_table_ip_nat (0.00s)
panic: runtime error: index out of range [16] with length 16 [recovered, repanicked]

goroutine 9 [running]:
testing.tRunner.func1.2({0x3313e0, 0x4ca41d8b40c0})
        /usr/lib/go-1.26/src/testing/testing.go:1974 +0x238
testing.tRunner.func1()
        /usr/lib/go-1.26/src/testing/testing.go:1977 +0x334
panic({0x3313e0?, 0x4ca41d8b40c0?})
        /usr/lib/go-1.26/src/runtime/panic.go:860 +0x12a
github.com/mdlayher/netlink.nlmsgFprintf({0x369020, 0x4ca41d920ba0}, {{0x28, 0xa00, 0x1, 0x1, 0x4d2}, {0x4ca41d8b4090, 0x14, 0x14}}, ...)
        /home/dswarbrick/netlink/debug_linux.go:176 +0x988
github.com/mdlayher/netlink.TestNlmsgFprintf.func1(0x4ca41d9fe488)
        /home/dswarbrick/netlink/debug_linux_test.go:207 +0x7a
testing.tRunner(0x4ca41d9fe488, 0x4ca41d8ae300)
        /usr/lib/go-1.26/src/testing/testing.go:2036 +0x118
created by testing.(*T).Run in goroutine 8
        /usr/lib/go-1.26/src/testing/testing.go:2101 +0x4f8
FAIL    github.com/mdlayher/netlink     0.004s
testing: warning: no tests to run
PASS
ok      github.com/mdlayher/netlink/nlenc       0.001s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/mdlayher/netlink/nltest      0.002s [no tests to run]
FAIL

Test passes as expected on amd64 / little-endian hosts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions