aboutsummaryrefslogtreecommitdiffstats
path: root/prog/resources_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-01-12 13:35:45 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-01-15 11:02:35 +0000
commit659da5e58b9a9c032a4127591796722120aa0c2f (patch)
treef223691565a57e21668a1dcc2ad5ca0f822a06b5 /prog/resources_test.go
parent551587c192ecb4df26fcdab775ed145ee69c07d4 (diff)
prog: restructure resource generation
If no matching resource was already present in the program, we used to substitute a random value in ~50% of cases. That's not efficient. Restructure the resource generation process so that, if there are no other options, we generate a new resource in 80% cases and in the remaining 20% we substitute an integer.
Diffstat (limited to 'prog/resources_test.go')
-rw-r--r--prog/resources_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/prog/resources_test.go b/prog/resources_test.go
index ca1a25965..c4da48e1e 100644
--- a/prog/resources_test.go
+++ b/prog/resources_test.go
@@ -196,7 +196,7 @@ func TestPreferPreciseResources(t *testing.T) {
target, rs, _ := initRandomTargetTest(t, "test", "64")
r := newRand(target, rs)
counts := map[string]int{}
- for i := 0; i < 1500; i++ {
+ for i := 0; i < 2000; i++ {
s := newState(target, target.DefaultChoiceTable(), nil)
calls := r.generateParticularCall(s,
target.SyscallMap["test$consume_subtype_of_common"])
@@ -207,7 +207,7 @@ func TestPreferPreciseResources(t *testing.T) {
counts[call.Meta.Name]++
}
}
- assert.Greater(t, counts["test$produce_common"], 15)
- assert.Greater(t, counts["test$also_produce_common"], 15)
- assert.Greater(t, counts["test$produce_subtype_of_common"], 100)
+ assert.Greater(t, counts["test$produce_common"], 70)
+ assert.Greater(t, counts["test$also_produce_common"], 70)
+ assert.Greater(t, counts["test$produce_subtype_of_common"], 1000)
}