See the "Static Analysis" section: http://www.sqlite.org/testing.html
See the "Static Analysis" section: http://www.sqlite.org/testing.html
If SA discovers a problem, you'll discover it the moment you run it through the analyzer, while by the dev's admission many of their bugs are discovered as bug reports. Which is clearly a bit later :)
Now, it might well be that most of SQLite's bugs simply are not discovered by SA. But SA is not going to report them later than bug reports, unless you use it very infrequently.
3 problems were detected by Coverity and fixed in SQLite.
Yes, as the page notes the SQLite codebase has a > 1000:1 tests to code ratio. I don't think there's any other codebase this thoroughly tested, and it makes sense that static analysis tools won't discover anything not already covered by tests.
and it makes sense that static analysis tools won't discover anything not already covered by tests
That assertion doesn't make a lot of sense to me. Most static analysers are capable of looking at the edge cases that a human may forget to write a test for, or may not even notice are there.Whenever a bug is reported against SQLite, that bug is not considered fixed until new test cases have been added to the TCL test suite which would exhibit the bug in an unpatched version of SQLite. Over the years, this has resulted in thousands and thousands of new tests being added to the TCL test suite. These regression tests ensure that bugs that have been fixed in the past are not reintroduced into future versions of SQLite.
While this is a great practice, it's reactive. It's the result of particular bugs, not someone asking, "What are the situations we haven't covered?"
The coverage they have for error conditions (file system, out of memory, bit-flips) is impressive. I'm not saying I know you're wrong, but I think there are too many variables to say with confidence either way.
If that's not good enough then I think static analysis is a decent step, but probably pales in comparison to using stricter languages (eg. Haskell).
This is generally exponential in number of functions, modules, etc involved. For example, a function with N if statements that are not nested generally needs 2^N testcases to properly exercise it.
So having 1000 times more tests than code may not mean that you have complete coverage at all. It depends on the structure of the tests and the code.
(Not disagreeing, I just had to go through this process in my head when I thought about what you said in comparison to what they said.)
For any nontrivial project, testing every codepath is basically impossible, unfortunately. :(
CompCert is a verified compiler that transforms code from "virtual machine" of language C to "virtual machine" of PowerPC.
It is generated from Coq, though.
But, please see ynot: http://ynot.cs.harvard.edu/
They have a verified SQL compiler. Again, generated from Coq source.
So I think you're wrong claiming that static analysis isn't useful for virtual machines. For C you have to have very extensive annotations, as it is not very expressive by itself, but static analysis is still possible.