【问题标题】:asdf:test-system from a Makefile doesn't return an error return codeasdf:test-system 来自 Makefile 不返回错误返回码
【发布时间】:2019-07-20 05:30:54
【问题描述】:

我的单元测试运行良好,但是当测试失败时make test 目标不会返回错误代码(echo $? 为 0)(当有 lisp 错误时它会返回)。

这对 CI 系统不利。

我的主要系统定义以in-order-to结尾:

  :in-order-to ((test-op (test-op "mysystem/test"))))

我的测试系统有一个perform一个:

  :perform (test-op (o s)
                    (uiop:symbol-call '#:mysestem.test '#:test-all)))

其中test-all 是一个使用run! 'test-suite 运行Fiveam 测试套件的函数。

制作目标:

test:
  # (with proper indentation…)
  $(LISP) --non-interactive \
    --eval "(asdf:load-asd \""$(ASD_PATH)"\")" \
    --eval "(ql:quickload :mysystem/test)" \
    --eval "(asdf:test-system \"mysystem\")"

请注意,跟随 ASDF 的 best practices 在做

                    (symbol-call :fiveam #':run! :test-suite)))

“函数 :run! 未定义”错误。

我们如何做到这一点?

谢谢。

【问题讨论】:

  • ASDF:TEST-SYSTEM 不会杀死图像,因此它不会以某种方式影响退出代码。如何以错误代码退出取决于实现,但 uiop 有 UIOP:QUIT
  • 这实际上是有道理的,因为我们可以从 repl 中调用它。所以我正在尝试像--eval "(unless (asdf:test-system \"mysystem\") (uiop:quit 1))" 这样的事情,但到目前为止没有成功。我有一个失败的测试,仍然是0,但最后一个输出是Didn't run anything...huh?,所以也许fiveam不会在这里返回nil
  • 现在我有一个干净的输出和一个失败的测试,但仍然echo $? = 0。
  • ASDF:TEST-SYSTEM 的返回值并不表示测试成功/失败。该手册建议从test-op 发出条件信号。

标签: common-lisp asdf


【解决方案1】:

好像有错别字:

  • '#:mysestem.test'#:mysystem.test
  • #':run!'#:run!

【讨论】:

  • run 是真的。我把它命名为测试套件的名称(如:test-suite),但它没有运行任何东西:/“没有运行任何东西......嗯?”
猜你喜欢
  • 1970-01-01
  • 2019-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-04
  • 1970-01-01
  • 2010-12-18
  • 1970-01-01
相关资源
最近更新 更多