编译并运行 test_package 文件的代码,用于检测代码是否被成功编译运行。

    为消费者测试包装的最后一步是test命令。 这一步很简单:

    1. $ conan test test_package hello/1.1@user/channel
    2. hello/1.1@user/channel (test package): Installing C:\Users\conan\repos\example_conan_flow\test_package\conanfile.py
    3. Requirements
    4. hello/1.1@user/channel from local
    5. Packages
    6. hello/1.1@user/channel:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
    7. hello/1.1@user/channel: Already installed!
    8. hello/1.1@user/channel (test package): Generator cmake created conanbuildinfo.cmake
    9. hello/1.1@user/channel (test package): Generator txt created conanbuildinfo.txt
    10. hello/1.1@user/channel (test package): Generated conaninfo.txt
    11. hello/1.1@user/channel (test package): Running build()
    12. ...

    通常需要反复重新运行测试,以检查包是否生成正确。
    总之,您可以使用默认文件夹,流程将非常简单:

    1. $ git clone https://github.com/conan-io/examples.git
    2. $ cd features/package_development_flow
    3. $ conan source .
    4. $ conan install . -pr=default
    5. $ conan build .
    6. $ conan package .
    7. # So far, this is local. Now put the local binaries in cache
    8. $ conan export-pkg . hello/1.1@user/testing -pr=default
    9. # And test it, to check it is working in the local cache
    10. $ conan test test_package hello/1.1@user/testing
    11. ...
    12. hello/1.1@user/testing (test package): Running test()
    13. Hello World Release!