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:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user