编译并运行 test_package 文件的代码,用于检测代码是否被成功编译运行。
为消费者测试包装的最后一步是test命令。 这一步很简单:
$ conan test test_package hello/1.1@user/channel
hello/1.1@user/channel (test package): Installing C:\Users\conan\repos\example_conan_flow\test_package\conanfile.py
Requirements
hello/1.1@user/channel from local
Packages
hello/1.1@user/channel:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
hello/1.1@user/channel: Already installed!
hello/1.1@user/channel (test package): Generator cmake created conanbuildinfo.cmake
hello/1.1@user/channel (test package): Generator txt created conanbuildinfo.txt
hello/1.1@user/channel (test package): Generated conaninfo.txt
hello/1.1@user/channel (test package): Running build()
...
通常需要反复重新运行测试,以检查包是否生成正确。
总之,您可以使用默认文件夹,流程将非常简单:
$ git clone https://github.com/conan-io/examples.git
$ cd features/package_development_flow
$ conan source .
$ conan install . -pr=default
$ conan build .
$ conan package .
# So far, this is local. Now put the local binaries in cache
$ conan export-pkg . hello/1.1@user/testing -pr=default
# And test it, to check it is working in the local cache
$ conan test test_package hello/1.1@user/testing
...
hello/1.1@user/testing (test package): Running test()
Hello World Release!