<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Bazel - 标签 - 星河拾贝录</title><link>https://blog.liubang.cc/tags/bazel/</link><description>Bazel - 标签 - 星河拾贝录</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>it.liubang@gmail.com (liubang)</managingEditor><webMaster>it.liubang@gmail.com (liubang)</webMaster><copyright>Copyright © 2019-2026 LiuBang. All Rights Reserved.</copyright><lastBuildDate>Sat, 23 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.liubang.cc/tags/bazel/" rel="self" type="application/rss+xml"/><item><title>测试体系：如何保证一个语言实现不退化</title><link>https://blog.liubang.cc/flux/2026-05-23-flux-engine-10-testing/</link><pubDate>Sat, 23 May 2026 00:00:00 +0000</pubDate><author><name>liubang</name></author><guid>https://blog.liubang.cc/flux/2026-05-23-flux-engine-10-testing/</guid><description><![CDATA[<p>语言和查询引擎项目最容易出现一种慢性问题：功能越加越多，旧语义悄悄坏掉。今天修 parser，明天改 runtime，后天补 connector pushdown，再过几天优化 LSP；如果没有清晰的测试分层，每次改动都会变成“看起来没问题”的冒险。</p>
<p><code>cpp/pl/flux</code> 现在已经有 scanner/parser、runtime evaluator、标准库、table pipeline、connector、optimizer、physical executor、CLI 和 LSP。它不是一个单点库，而是一条从源码到编辑器、从 AST 到查询执行、从语义到性能的链路。测试体系要守住的不是某个函数，而是这条链路的边界。</p>
<p>这一篇讲的不是“多写测试”这种泛泛建议，而是 Flux 项目当前如何分层：哪些 bug 应该落在 parser test，哪些应该落在 runtime eval，哪些必须进入 conformance，哪些只能靠 benchmark 观察趋势。</p>
<h2 id="测试不是一类" class="headerLink">
    <a href="#%e6%b5%8b%e8%af%95%e4%b8%8d%e6%98%af%e4%b8%80%e7%b1%bb" class="header-mark"></a>测试不是一类</h2><p>当前测试大致分成这些层：</p>
<ul>
<li>scanner / strconv unit test。</li>
<li>parser unit test 和 AST dump。</li>
<li>runtime value/env/eval/page/exec unit test。</li>
<li>connector runtime/source unit test。</li>
<li>optimizer RBO/CBO unit test。</li>
<li>CLI unit/smoke test。</li>
<li>stdlib conformance test。</li>
<li>cross-source 和 feature examples。</li>
<li>LSP unit test。</li>
<li>benchmark runner。</li>
<li>静态检查。</li>
</ul>
<p>每一层守不同边界。parser test 不应该承担 runtime 正确性；runtime eval test 不应该依赖真实 MySQL；LSP test 不应该通过人工打开编辑器来证明 JSON-RPC 正确；benchmark 更不应该伪装成 correctness test。</p>]]></description></item></channel></rss>