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 is LLVM tested?

137 pointsby AlexDenisovabout 9 years ago

4 comments

DannyBeeabout 9 years ago
&quot;Amount of unit tests is pretty small comparing to regression tests. One reason behind that decision is that LLVM internals constantly change all the time. &quot;<p>Well, no, and i&#x27;m not sure where they got this. It&#x27;s not a &quot;decision&quot;. BTW, This also assumes that all of the tests in the unit test dir are unit tests, and all the tests in test&#x2F; are regression tests.<p>This is explicitly false.<p>The general viewpoint of LLVM is that most things people write (analysis, optimization) should be tested by checking the IR or dumps. That is, we want easy to follow and modify unit tests, not just compilable C++ code ones.<p>Thus, you will find a lot of unit tests that are in test&#x2F;, instead of unittest&#x2F;, because they are testable using IR printers.<p>Those things that are API&#x27;s should be tested by unittests, and work is underway to increase coverage. The reason some things aren&#x27;t cover is simply that in the earlier days of the project, not all of this got unit tests, and it&#x27;s only in the past couple years that people have become sticklers about it.<p>So that one would be knowingly &quot;not enforcing good development practices&quot;, not &quot;llvm internals change all the time&quot;. The fact that internals change all the time is in fact a <i>good</i> reason to <i>have</i> unit tests.
评论 #11360898 未加载
kderbeabout 9 years ago
If you&#x27;re interested in the testing techniques used by established open source software, here are a couple projects that appear to have far more extensive test coverage than LLVM:<p>SQLite ( <a href="https:&#x2F;&#x2F;sqlite.org&#x2F;testing.html" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;testing.html</a> )<p>Opus ( <a href="https:&#x2F;&#x2F;www.ietf.org&#x2F;proceedings&#x2F;82&#x2F;slides&#x2F;codec-4.pdf" rel="nofollow">https:&#x2F;&#x2F;www.ietf.org&#x2F;proceedings&#x2F;82&#x2F;slides&#x2F;codec-4.pdf</a> )<p>I don&#x27;t mean it as criticism of the LLVM project, as I haven&#x27;t worked with it and can&#x27;t say whether its tests are sufficient. Only that, from reading this overview, its testing techniques do not seem particularly elaborate.
评论 #11362044 未加载
评论 #11369123 未加载
评论 #11360822 未加载
a_imhoabout 9 years ago
Very nice. Anyone could point me to LLVM&#x27;s code coverage and whether they use TDD?<p>&quot;Amount of unit tests is pretty small comparing to regression tests. One reason behind that decision is that LLVM internals constantly change all the time. Supporting tests under such conditions is very time consuming.&quot;<p>Isn&#x27;t the whole promise of testing is easier maintenance in the long run? Also, regression tests seem to run much faster, is it because of the Google Test?
评论 #11360133 未加载
评论 #11360121 未加载
评论 #11359945 未加载
评论 #11360270 未加载
评论 #11359932 未加载
krzrakabout 9 years ago
Very interesting article, thanks!