2
0
mirror of https://github.com/boostorg/uuid.git synced 2026-01-19 04:42:16 +00:00

Compile tests without running in CI if the CPU lacks required features.

This allows for testing that the ISA-specific code at least compiles,
even if running the tests isn't possible.

The support is only added to b2, CMake still always compiles and runs
the tests to keep using boost_test_jamfile for easier maintenance. In
the future, similar support can be added to CMake as well.
This commit is contained in:
Andrey Semashev
2026-01-09 02:58:33 +03:00
parent ba77fe2781
commit b135a5d816
2 changed files with 16 additions and 2 deletions

View File

@@ -355,8 +355,8 @@ jobs:
if ! [[ "$cpu_flags" =~ $re ]]
then
echo "CPU lacks required feature: $requirement"
echo "Skipping testing"
exit 0
echo "Skipping running tests"
export BOOST_UUID_SKIP_RUNNING_TESTS=1
fi
done
fi

View File

@@ -34,6 +34,20 @@ import path ;
import regex ;
import testing ;
# The rule allows for suppressing running tests and instead only compile them.
# This is useful e.g. if the tests are compiled for a target ISA that is not supported by the CPU.
local rule run ( sources + : args * : input-files * : requirements * : target-name ? : default-build * )
{
if [ os.environ BOOST_UUID_SKIP_RUNNING_TESTS ]
{
return [ testing.compile $(sources) : $(requirements) : $(target-name) ] ;
}
else
{
return [ testing.run $(sources) : $(args) : $(input-files) : $(requirements) : $(target-name) : $(default-build) ] ;
}
}
# this rule enumerates through all the headers and ensures
# that inclusion of the header by itself is sufficient to
# compile successfully, proving the header does not depend