summaryrefslogtreecommitdiff
path: root/integrationtests/cmd/ioworkload/scenario_pidfd_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrationtests/cmd/ioworkload/scenario_pidfd_test.go')
-rw-r--r--integrationtests/cmd/ioworkload/scenario_pidfd_test.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/integrationtests/cmd/ioworkload/scenario_pidfd_test.go b/integrationtests/cmd/ioworkload/scenario_pidfd_test.go
new file mode 100644
index 0000000..5ee1002
--- /dev/null
+++ b/integrationtests/cmd/ioworkload/scenario_pidfd_test.go
@@ -0,0 +1,57 @@
+package main
+
+import "testing"
+
+func TestPidfdOpenSyscallNrForArch(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ arch string
+ want uintptr
+ wantErr bool
+ }{
+ {name: "amd64", arch: "amd64", want: 434},
+ {name: "arm64", arch: "arm64", want: 434},
+ {name: "unsupported", arch: "riscv64", wantErr: true},
+ } {
+ got, err := pidfdOpenSyscallNrForArch(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)
+ }
+ }
+}
+
+func TestPidfdGetfdSyscallNrForArch(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ arch string
+ want uintptr
+ wantErr bool
+ }{
+ {name: "amd64", arch: "amd64", want: 438},
+ {name: "arm64", arch: "arm64", want: 438},
+ {name: "unsupported", arch: "riscv64", wantErr: true},
+ } {
+ got, err := pidfdGetfdSyscallNrForArch(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)
+ }
+ }
+}