【发布时间】:2015-11-19 12:34:31
【问题描述】:
我们利用 autotools (autoconf&automake) 基础架构在我们的软件中进行了多项回归测试。这些回归测试根据它们测试的功能/单元分为不同的子目录。我们发现,一旦其中一个子目录在任何测试中失败,即将到来的子目录中的后续测试都不会执行,因此我们无法全面了解哪些功能继续按预期工作。有没有办法改变这种行为并强制执行所有测试,即使有些测试失败了?
考虑以下最小示例,其中 subdir1 失败,然后 make 检查不进行到 subdir2。使用 make check 的输出(通过 autoreconf -fiv 和简单的 ./configure 调用生成配置后)是:
...
make[2]: Entering directory `x/subdir1'
make[3]: Entering directory `x/subdir1'
FAIL: fail
PASS: pass
make[4]: Entering directory `x/subdir1'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `x/subdir1'
============================================================================
Testsuite summary for test 1.0
============================================================================
# TOTAL: 2
# PASS: 1
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
============================================================================
See subdir1/test-suite.log
============================================================================
make[3]: *** [test-suite.log] Error 1
make[3]: Leaving directory `x/subdir1'
make[2]: *** [check-TESTS] Error 2
make[2]: Leaving directory `x/subdir1'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `x/subdir1'
make: *** [check-recursive] Error 1
这个小测试的文件是:
configure.ac
AC_INIT([test], [1.0])
AM_INIT_AUTOMAKE()
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
subdir1/Makefile
subdir2/Makefile
])
AC_OUTPUT
subdir1/Makefile.am
check_PROGRAMS = fail pass
TESTS = fail pass
fail_SOURCES = fail.c
pass_SOURCES = pass.c
subdir2/Makefile.am
check_PROGRAMS = pass
TESTS = pass
pass_SOURCES = pass.c
fail.c 和 pass.c 的共享源
pass.c
int main (void)
{ return 0; }
fail.c
int main (void)
{ return 1; }
【问题讨论】:
标签: testing automated-tests autotools automake regression-testing