Skip to content

Test should not be disabled by default #3107

@Fleischner

Description

@Fleischner

Building from source needs testing. I encountered already some issues with my own ports.
In most ports building tests are disabled and there is no way to run tests easily.
I think this is wrong.

In many ports tests can be enabled by simply changing an cmake option (that often is marked as OFF in the triplet file)
However sometimes the port does not build anymore as issues with the tests are not fixed in the portfile.

==> Would be great if port maintainers try to ensure that the port builds also with tests enabled! Thanks!

I suggest to:

  • Add an triplet-option or environment-option as VCPKG_BUILD_TESTS_IF_AVAILABLE
  • Start with enabling tests in ports that use cmake. Portfiles should forward this variable to the corresponding variable for the port
  • It seems tests are not installed to the package and remain in the buildtree (This is ok. Also installing tests to the package folder by analysing the CTestTestfile.cmake would be an nice option for the future)
  • Add an triplet-option or environment-option as VCPKG_RUN_TESTS_IF_AVAILABLE
  • Cmake tests can be run by calling Ctest from the directory ./buildtrees/port/triplet-configuration
  • As test are in the buildtree directory, and the current port in build is not installed yet, it is necessary to add both the .installed/.../bin and ./installed/packages/port/..../bin directory to the path (depending on the triplet and configuration). I assume its therefore best to run the test command in new console.
  • Add an vcpkg command to easily run tests on a port, or run it automatically after build depending on the value of VCPKG_RUN_TESTS_IF_AVAILABLE
  • And log test results to the .buildtree/port

I currently try to get parts of this to work and will post any results that might help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions