aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rotation_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-01-05 10:47:41 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-01-05 11:16:20 +0100
commitc2de3766243ed8955ab83e59bd5e4d60cb81bac9 (patch)
tree2bbaa1b9d8189e5c2830e757c709705e342cc1e7 /prog/rotation_test.go
parent270cde8ebe422a3197eec97faf00d3f10b0b0148 (diff)
prog: fix oob panic in rotatorState.Select
Reported-by: ManhNDd Fixes #2372
Diffstat (limited to 'prog/rotation_test.go')
-rw-r--r--prog/rotation_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/prog/rotation_test.go b/prog/rotation_test.go
index 4a7aa31cc..e218a5eb6 100644
--- a/prog/rotation_test.go
+++ b/prog/rotation_test.go
@@ -9,8 +9,21 @@ import (
"math/rand"
"sort"
"testing"
+
+ "github.com/google/go-cmp/cmp"
)
+func TestRotationResourceless(t *testing.T) {
+ target, rs, _ := initRandomTargetTest(t, "test", "64")
+ calls := map[*Syscall]bool{
+ target.SyscallMap["test$int"]: true,
+ }
+ got := MakeRotator(target, calls, rand.New(rs)).Select()
+ if diff := cmp.Diff(calls, got); diff != "" {
+ t.Fatal(diff)
+ }
+}
+
func TestRotationRandom(t *testing.T) {
target, rs, _ := initTest(t)
for _, ncalls := range []int{10, 100, 1000, 1e9} {