Closed clinty closed 12 years ago
Weird. When I build and run tests/suite
I cannot make it fail, but when I run cabal test
it almost never succeeds. What are they doing differently?
Ok, this is breaking my brain. When I do encodes in ghci
, they always work, even on the data that the tests say are bad. When I used Debug.Trace
to check what bytes the tests encoded to, there is one byte that is different on bad ones than what I get in ghci
... but the code is the same... what?
When I change cabal to build with -O0
it works just fine... so... some optimisation is messing things up? That's not good...
I switch to building everything with -O2
and now tests/suite
also fails, so it's definitely the optimisations...
Posted a StackOverflow question: http://stackoverflow.com/questions/12361085/why-does-this-code-behave-differently-with-optomisations-on-or-off
SignatureSubpacket encode/decode: [Failed] Falsifiable with seed 1314239006134442727, after 79 tests. Reason: EmbeddedSignaturePacket (SignaturePacket {version = 2, signature_type = 168, key_algorithm = ECDSA, hash_algorithm = SHA256, hashed_subpackets = [], unhashed_subpackets = [SignatureCreationTimePacket 1013401916,IssuerPacket "36FE856F4219F1C7"], hash_head = 48065, signature = [MPI 4,MPI 11,MPI 60,MPI 69,MPI 37,MPI 33,MPI 18,MPI 72,MPI 41,MPI 36,MPI 43,MPI 41,MPI 53,MPI 9,MPI 53,MPI 35,MPI 3,MPI 40,MPI 14,MPI 79,MPI 1,MPI 4,MPI 51,MPI 23,MPI 62,MPI 62,MPI 62,MPI 7,MPI 68,MPI 51,MPI 13,MPI 49,MPI 8,MPI 64,MPI 32,MPI 50,MPI 59,MPI 17,MPI 43,MPI 12,MPI 67,MPI 5,MPI 67,MPI 5,MPI 25,MPI 63,MPI 0,MPI 53,MPI 2,MPI 36,MPI 83,MPI 39,MPI 54,MPI 65,MPI 54,MPI 35,MPI 62,MPI 63,MPI 26,MPI 4,MPI 82,MPI 57,MPI 85,MPI 71,MPI 43,MPI 77], trailer = Chunk "\168" (Chunk "<gI<" Empty)}) S2K count: