TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How SQLite is tested

176 pointsby antoniosover 12 years ago

11 comments

chris_wotover 12 years ago
One of my proudest moments was finding a bug in SQLite where a corrupted index caused a select statement to segfault Firefox.<p>I jumped through a <i>lot</i> of hoops to get to the point where I got a backtrace that showed me the SQL statement of a corrupted places.sqlite. I then loaded SQLite on the data file, ran the statement and reproduced the segfault. One of their lead devs then got in contact with me, grabbed the data file and fixed the issue.<p>I suspect that not only did my diagnosis lead to a fix for a LOT of Firefox crashes, but it stopped a lot of frustrating crashes on things like iPhones, etc :-)<p>I may not have done the fix, but I took the time to reproduce the problem. It felt damn good :-)<p>P.S. in case anyone is interested, the bug is <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=581946" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=581946</a> on Mozilla, and at SQLite it's at <a href="http://www.sqlite.org/src/ci/83395a3d24" rel="nofollow">http://www.sqlite.org/src/ci/83395a3d24</a>
评论 #4617634 未加载
评论 #4617593 未加载
评论 #4618924 未加载
评论 #4619063 未加载
tedunangstover 12 years ago
Unfortunately, 100% testing is only effective if you can detect 100% of the errors generated. The only bug I found in sqlite was an off by one in the btree code that was mostly harmless, unless your memory allocator was particularly fussy.<p>I only found the bug, never quite understood it, and after seeing how disturbing the fix was decided some things were best left unlearned. <a href="http://www2.sqlite.org/cgi/src/fdiff?v1=fa113d624d38bcb36700a0244b47f39d57d34efb&#38;v2=8cab7c66c822ae9c37c59a923ffec81927583ee2" rel="nofollow">http://www2.sqlite.org/cgi/src/fdiff?v1=fa113d624d38bcb36700...</a><p>That said, sqlite is one of the most reliable and better designed libraries I've used. Software is hard.
评论 #4617095 未加载
评论 #4617169 未加载
josephlordover 12 years ago
Is there any more widely deployed software in the world than SQLite? Multiple copies (browsers, language runtimes, embedded in other software) on many computers and built into most smartphones and its probably in quite a few TVs and other devices too.<p>Very successful invisible (to non-developers) software.
评论 #4617156 未加载
评论 #4617094 未加载
评论 #4617547 未加载
jemfinchover 12 years ago
What I'm more interested in is <i>how</i> SQLite reached such substantial test coverage. What techniques or tools were used to generate the tests? Did someone (drh?) actually sit down, read through the code, and construct a test case for every branch, or did they use tools to facilitate test case construction? How can I apply the same effort to my own software (once it's ready) to improve its reliability?
评论 #4617536 未加载
评论 #4620306 未加载
lremover 12 years ago
You should definitely see drh present it in person. He's giving a talk about it in universities around the world, seen it a couple years back, in Poland. It's incredible what effort goes into reliability of what seems such a small thing.<p>Btw, the very same day he persuaded me to move to Fossil.<p>Edit: just to be clear, you should see it for all the good ideas he's explaining. Not for some marketing of a piece o of software.
评论 #4617142 未加载
dblockover 12 years ago
Can anyone please comment on the humans involved in running some of this stuff? What are their roles, occupations? Infrastructure? Who owns that?
zandorgover 12 years ago
Well, I told the author of SQLite that a double inner join took forever to complete. He just told me I was wrong, but this inner join worked fine on PostGres, MySql and so on.<p>It annoys me, because neither PostGres not MySql are a binary file you can just run with a query, unlike SQLite which is very convenient for embedding in a desktop app.
评论 #4618689 未加载
评论 #4617470 未加载
kderbeover 12 years ago
My takeaway from this is high-quality software needs several robust test suites, each written with a different testing methodology.<p>A presentation from the Opus audio codec developers ( <a href="http://www.ietf.org/proceedings/82/slides/codec-4.pdf" rel="nofollow">http://www.ietf.org/proceedings/82/slides/codec-4.pdf</a> ) opened my eyes to just how many overlapping approaches you can use. In addition to listing a dizzying array of software tests (similar to the SQLite article), the Opus presentation summarizes the strengths and weaknesses of each approach, which is great for understanding when each approach is appropriate to use.
YZFover 12 years ago
This Google Talk starting about 32:35 the author talks a little about SQLite testing: <a href="http://www.youtube.com/watch?v=f428dSRkTs4" rel="nofollow">http://www.youtube.com/watch?v=f428dSRkTs4</a>
dgregdover 12 years ago
Does anyone know the real reason SQLite was removed form HTML5 specs?<p>I known official Mozilla arguments. Which are quite week IMHO.<p>Is this was MS job? They where afraid that browser apps will make desktop apps obsolete?
评论 #4620991 未加载
anonymousDanover 12 years ago
Anyone have any thoughts on how they might be doing 'automatic' memory/resource leak detection (Section 6.0)? Seems to me it would be hard to do without generating lots of false positive failures.