Joe Ranweiler
23af5b562d
Add DeepState_Crash() hook
2018-02-14 12:22:38 -08:00
Joe Ranweiler
86d0fac206
Log error when test crashes
2018-02-14 12:06:26 -08:00
Joe Ranweiler
ac7e57a833
Consistently stub test case save hooks
2018-02-14 10:24:15 -08:00
Joe Ranweiler
ab43f75361
Add hook to save crashing tests
2018-02-14 10:24:15 -08:00
Joe Ranweiler
68595a9493
Fix handling of test failures due to uncaught exceptions
...
We don't just want to exit here, but `longjmp()` back to the conditional
via a call to `DeepState_Fail()`. In doing so, we end up in the common
`DeepState_CatchFail()` branch, which exits with the same nonzero error
code, but also saves the test case if appropriate.
2018-02-14 10:10:51 -08:00
Joe Ranweiler
a68520642a
Fully factor out forking and running a single test
2018-02-13 14:37:14 -08:00
Joe Ranweiler
3c5d5daeaf
Use more accurate function name
2018-02-13 14:37:14 -08:00
Joe Ranweiler
b61b3e7f2d
Fork for all test runs
2018-02-13 14:37:14 -08:00
Joe Ranweiler
8f39961b3f
Save result of forked test run if flag set
2018-02-13 14:37:14 -08:00
Joe Ranweiler
8ff5f6cac6
Fork when running saved test cases
...
This anticipates support for crashing tests.
2018-02-13 14:23:44 -08:00
Joe Ranweiler
879000bc73
Document functions for running saved test cases
2018-02-11 12:52:56 -08:00
Joe Ranweiler
d25a181771
Fix indent level
2018-02-10 16:09:37 -08:00
Joe Ranweiler
579cba3705
Check for error when stating test input file
2018-02-10 16:09:37 -08:00
Joe Ranweiler
d81cbba137
Clear log stream before failing with longjmp in fatal log
...
When an assertion fails in the C++ API, it ultimately invokes a
`Fatal`-level `DeepState_Log()`. This calls `DeepState_Fail()`, which
longjmps. If we don't clear the log buffer here, it won't get cleared by
the usual logic which does so. This causes hanging, unflushed log
messages to persist between tests.
This relationship should eventually be inverted and decoupled.
2018-02-10 16:09:37 -08:00
Joe Ranweiler
4a90b2a5e8
Skip tests with no saved cases to run
2018-02-10 16:09:37 -08:00
Joe Ranweiler
f3d13e37b3
Factor out initializing input from file
2018-02-10 16:09:36 -08:00
Joe Ranweiler
78cc5d46be
Add initial impl of running saved test cases
2018-02-10 16:09:36 -08:00
Joe Ranweiler
2c7334ab0d
Fix typo in error message
2018-02-10 16:09:36 -08:00
Joe Ranweiler
dd8a1c6608
Use external linkage for global input buffer
...
This is to support running saved auto-generated test cases.
2018-02-08 16:07:35 -08:00
Joe Ranweiler
c6eca451c5
Fix flag decl and defs
2018-02-08 14:16:16 -08:00
Peter Goodman
1aa468dabc
Minor formatting changes.
2018-02-06 12:18:06 +08:00
Peter Goodman
2eaeb7480c
Adding Google Flags-like command-line option parsing, though implemented in C, to the main executable. The code is ported from Granary2.
2018-01-07 16:25:31 -05:00
Peter Goodman
622afcdb98
Made variadic argument lists work in 32 bit x86.
2017-12-13 23:53:48 -05:00
Peter Goodman
303da80e78
Add OneOf for C-strings, vectors, and arrays.
2017-12-13 23:08:50 -05:00
Peter Goodman
1433f34960
Makeing 100% sure that the format_bufs are NUL-terminated.
2017-12-13 22:46:20 -05:00
Peter Goodman
7c585f5c44
Add 32-bit support, i.e. libdeepstate32
2017-12-13 21:53:33 -05:00
Peter Goodman
f4dd61f895
Added overrides for assert_fail and stack_chk_fail.
2017-12-13 14:16:21 -05:00
Peter Goodman
308fe70eb6
Hooked __assert_fail into the logging system.
2017-12-13 12:43:34 -05:00
Peter Goodman
5a84f665b6
Minor tweak.
2017-12-13 01:31:29 -05:00
Peter Goodman
e9bd6dc177
Fixes one or two subtle issues. But the more interesting fix is that I implemented puts in terms of DeepState_Log. Calls to printf that had no format arguments are transformed by the compiler into calls to puts, but that wasn't being wrapped by DeepState, so it was appearing as though those log messages never actually happened.
2017-12-12 14:01:41 -05:00
Peter Goodman
669f6cf3f9
Made the OneOf example work.
2017-12-11 19:40:39 -05:00
Peter Goodman
8248bbdcbc
Removed usage of old name, added in a Euler power of like primes example. When the pairwise ASSERT_NEs are absent, you get interesting results that show examples of integer overflows.
2017-12-10 20:08:08 -05:00
Peter Goodman
fcd000dc14
Added a maximize objective API to DeepState.
2017-12-10 13:37:47 -05:00
Peter Goodman
188d4517d8
Added prime polynomial example, new Pumping function to address scalability challenges with primality testing, and some improvements to the streaming interface, where if you don't stream in values, then the python side doesn't end up printing out some 'empty' stream infos.
2017-12-09 16:43:43 -05:00
Peter Goodman
3aaaf71b85
Added support for c++ test fixtures.
2017-12-08 23:58:59 -05:00
Peter Goodman
f9fb7e81be
Initial progress in Issue #7 with support for a Dr. Fuzz harness.
2017-12-08 21:07:52 -05:00
Peter Goodman
a411f0e032
Adds ONE_OF. Breaks some lines at 80 columns.
2017-12-07 20:05:06 -05:00
Peter Goodman
5f36822021
Made the report function concretize using the minimizer, so that eventually we'll be able to compare inputs generated across tools
2017-11-09 10:35:48 -05:00
Peter Goodman
6ec7d71188
Added error checking.
2017-11-02 01:05:15 -04:00
Peter Goodman
a093a82ef9
Merge branch 'master' of github.com:trailofbits/deepstate
2017-11-02 00:54:22 -04:00
Peter Goodman
c4f74e2389
Adds some error checking around finding important symbols and initializing Manticore/Angr. Adds the ability to save concretized bytes to an output directory. For the time being, I'm going with the approach of the user specifying a output dir, then within that I create directories for each file basename in the tests, and subdirectories for each test name, and in there I put binary test files.
2017-11-02 00:54:18 -04:00
Artem Dinaburg
07fb0fb4c8
build using clang 4.0
2017-11-01 22:59:17 -04:00
Peter Goodman
4f914e4eee
Fixes to stream formatting of doubles, they weren't being streamed before. Implemented the chk versions of printf and such, so that they all route through the logging interface as well. Implemented the concretization APIs.
2017-11-01 17:56:54 -04:00
Peter Goodman
d2bc82fc35
Renaming from McTest to DeepState.
2017-11-01 13:38:32 -04:00
Peter Goodman
a46e06b03b
Refactored to split common code between Manticore and Angr out into common.py. Implemented the new deferred streaming stuff, it seems to work semi-well for this simple cases I've tested, but there's still work to do. The latest code has some remaining issues. Printing out the final input bytes in Angr shows the wrong thing, although what gets streamed out is right. This is visible when running mctest-angr examples/ArtihmeticProperties. With Manticore, the big issue is that it doesn't properly pickle smt expressions (or something to this effect), so I'm ending up with multiple definitions of the same stuff and that throws exceptions. This is tricky to deal with because the streaming of output needs to be able to save symbolic data.
2017-11-01 02:42:31 -04:00
Peter Goodman
3702bfcb81
Changed how the logging works to log to a static buffer, then the hooks pull info out from there.
2017-10-30 14:16:02 -04:00
Peter Goodman
e4f4cfe0db
Kind of feature parity between Manticore and Angr on these tests.
2017-10-30 00:45:59 -04:00
Peter Goodman
4b786adc70
Got Manticore (with some minor unpublished fixes) working for McTest, based on Yan's initial work. Most of the angr code directly ports over, which is convenient. Haven't yet implemented McTest_Log (which isn't working for angr, curiously).
2017-10-29 20:35:50 -04:00
Peter Goodman
e0f104aaef
Adding logger support, and other things.
2017-10-29 18:54:41 -04:00
Peter Goodman
7c9710cd05
Remove IsSymbolic preficate for pointers.
2017-10-28 20:26:43 -04:00