Closed j-hui closed 3 years ago
I still need to merge in the Changed
operator from 3c44426e9c2f91c56c132ae87064fdf4eee3baf8. I'll do that tomorrow.
I merged the Changed
operator from master, and this seems to be passing valgrind tests, but it's not passing the prop_correct
tests.
@Rewbert , what's the workflow for debugging that? It just dumps a program but I'm not really sure where to find the compiled .c
file and inspect it myself etc.
Oh and of course, I still need to document this entire file. That should happen before this PR is merged
So you issue stack test
and it will start randomly running programs against your property. When it finds a program that fails the property it will shrink it and then dump it to a few files. E.g if the property failed it will dump them to fail.c
, fail.out
and fail.ssm
. fail.c
is just the generated code, fail.out
contains a prettyprint of the traces of the two runs, so that you can see where they performed differently. fail.ssm
contains a show
'd version of the program. If you issue stack install
you can then run print-ssm-from-file fail.ssm
and it will show you a prettyprinted version of the program.
Similarly, it will create comperror.c
& comperror.ssm
if the program did not compile without errors/warnings, execerror.c
& execerror.ssm
if the program was compiled but crashed during execution (e.g by an assertion failing). Finally, parseerror.c
& parseerror.ssm
, if it could run the program but then not parse the results to a format Haskell understands.
I fixed that bug, and tests are passing! Your suggestion was correct---it was a formatting issue after all. I also added a bunch of documentation to this module.
There are still some changes I would like to make to this module, but probably for a later PR/task.
I let the tests run for a while and found two bugs, which I've fixed above! Now I can run the tests and several thousand of them passes. I see no reason why we could not merge this PR now :)
Overall, a few changes:
int32
rather than using the nativeint
. This makes clear the size of the type, and also avoids using the C keywordint
in the place of an identifier (and streamlines the type naming scheme too).if
andwhile
statements. Instead, thecase
labels are directly inserted into C's conditional and loop statements. This should be functionally equivalent.