1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package main
import "testing"
func TestListnsSyscallNrForArch(t *testing.T) {
for _, tc := range []struct {
name string
arch string
want uintptr
wantErr bool
}{
{name: "amd64", arch: "amd64", want: 470},
{name: "arm64", arch: "arm64", want: 470},
{name: "unsupported", arch: "riscv64", wantErr: true},
} {
got, err := listnsSyscallNrForArch(tc.arch)
if tc.wantErr {
if err == nil {
t.Fatalf("%s: expected error", tc.name)
}
continue
}
if err != nil {
t.Fatalf("%s: unexpected error: %v", tc.name, err)
}
if got != tc.want {
t.Fatalf("%s: got %d, want %d", tc.name, got, tc.want)
}
}
}
|