aboutsummaryrefslogtreecommitdiffstats
path: root/prog/prio_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-17 10:24:13 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-18 11:34:42 +0200
commit9d7b583eae5f9d459920d207848863917fc58416 (patch)
tree1937b6ba28dc8f669b769279e8ed2ec95f73d1d7 /prog/prio_test.go
parentb6fa239fd5e9e120ac2b8e9f3d7f608125a7f986 (diff)
prog: reduce size of -short tests
Reduce size of tests that run for more than 1s in short mode.
Diffstat (limited to 'prog/prio_test.go')
-rw-r--r--prog/prio_test.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/prog/prio_test.go b/prog/prio_test.go
index 29ffa26d7..4497233b4 100644
--- a/prog/prio_test.go
+++ b/prog/prio_test.go
@@ -30,12 +30,11 @@ func TestNormalizePrio(t *testing.T) {
// Test static priorities assigned based on argument direction.
func TestStaticPriorities(t *testing.T) {
- target, rs, iters := initTest(t)
- if iters < 100 {
- // Both -short and -race reduce iters to 10 which is not enough
- // for this probabilistic test.
- iters = 100
- }
+ target := initTargetTest(t, "linux", "amd64")
+ rs := rand.NewSource(0)
+ // The test is probabilistic and needs some sensible number of iterations to succeed.
+ // If it fails try to increase the number a bit.
+ const iters = 5e4
// The first call is the one that creates a resource and the rest are calls that can use that resource.
tests := [][]string{
{"open", "read", "write", "mmap"},
@@ -49,7 +48,7 @@ func TestStaticPriorities(t *testing.T) {
referenceCall := syscalls[0]
for _, call := range syscalls {
count := 0
- for it := 0; it < iters*10000; it++ {
+ for it := 0; it < iters; it++ {
chosenCall := target.Syscalls[ct.choose(r, target.SyscallMap[call].ID)].Name
if call == referenceCall {
counter[chosenCall]++