-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test generation #21
Test generation #21
Conversation
I think #19 is almost mergeable (modulo cleaning up history?), which would make it easier to review this :) I'm not sure why #15 was rewritten, but okay, some suggestions from that PR:
|
Thanks for looking. I'll wait with #19 to give someone from multicore team a chance to take look. This was written specifically to test source sets and departs from #15 in quite a few ways. But suggestions sound good:
|
890e668
to
fcea188
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a lot to comment, it seems to be working fine as expected ! (except for some small funny mistakes in the command line part). It would be interesting to have a README specifying a (even simplified) grammar of generated code.
src/tracedAtomic.ml
Outdated
let len = List.length enabled in | ||
if len == 0 then () | ||
else | ||
let random_index = Random.int (List.length enabled) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List.length enabled
is len
tests/gen_program.ml
Outdated
( "-test-count", | ||
Arg.Set_int test_count, | ||
"number of programs to generate and test" ); | ||
("-print-tests", Arg.Set print_tests, "print all tests"); | ||
( "-global-vars-count", | ||
Arg.Set_int globals_count, | ||
"number of shared atomic variables (the more, the higher the reduction)" | ||
); | ||
( "-value-limit", | ||
Arg.Set_int value_limit, | ||
"range of values used by generated operations" ); | ||
( "-operations-count", | ||
Arg.Set_int operations_count, | ||
"number of operations per thread" ); | ||
("-thread-count", Arg.Set_int thread_count, "number of threads"); | ||
( "-generate-conditionals", | ||
Arg.Set generate_conditionals, | ||
"enable/disable generation of conditional statements" ); | ||
("-seed", Arg.Set_int seed, "random seed for generation"); | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have default values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I meant : having the default values printed in the -help
doc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/gen_program.ml
Outdated
let value_limit = ref 3 in | ||
let operations_count = ref 3 in | ||
let thread_count = ref 3 in | ||
let generate_conditionals = ref true in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be false by default if you want the optional flag to activate it.
tests/gen_program.ml
Outdated
|
||
let run config test_count = | ||
Printf.printf "\n\n"; | ||
for i = 0 to test_count do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually generated test_count+1
tests :p
fcea188
to
a2e28fc
Compare
Rebased after merging the better-traces and addressed feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
ddae4aa
to
e849cc9
Compare
(Based on #19)
Now, that we can easily compare traces covered by any exploration, let's automatically generate sample programs and run them under DSCheck. That lets us run automatic search for skipped traces. Heavily inspired by #15.
Includes:
do_run
- slower than just running the test but more likely to find some executions. It's useful for testing current DPOR but also in the future, as more optimised DPOR terminate on many tests on which current DSCheck does not.With above, we can either ensure than an implementation has explored at least all the traces that random sampling has seen, or assert that two implementations have seen exactly the same set of traces.
Testing
I haven't written automated tests. I tested it against DSCheck including a bug introduced on purpose e.g. 0.01% chance to skip a transition or insertion of trace.
Sample generations