CxxTest 文档有一个生成和运行单元测试的Makefile示例。我如何为自动化(Makefile.am)做同样的工作呢?
发布于 2015-09-29 07:05:53
为此,我在一个Makefile.am目录中创建了这个tests,其中所有的测试代码都是:
check_PROGRAMS = tests
EXTRA_tests_SOURCES = test_example1.hpp
EXTRA_tests_SOURCES += test_example2.hpp
tests_SOURCES = runner-autogen.cpp
BUILT_SOURCES = runner-autogen.cpp
MAINTAINERCLEANFILES = runner-autogen.cpp
runner-autogen.cpp: $(EXTRA_tests_SOURCES)
/path/to/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o $@ $<这样做是将runner-autogen.cpp编译到测试程序(称为tests)中,并使用make check运行它。如果列出的.hpp文件中有任何更改,它将运行cxxtestgen来重新创建runner-autogen.cpp。
因为runner-autogen.cpp是作为源文件列出的,因此它将由make dist包含在发行版存档中,因此除非用户修改.hpp文件之一,否则用户将不需要cxxtest。
https://stackoverflow.com/questions/28421181
复制相似问题