2
0
mirror of https://github.com/boostorg/uuid.git synced 2026-01-19 04:42:16 +00:00
Files
uuid/test/Jamfile.v2
Andrey Semashev b135a5d816 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.
2026-01-10 12:15:59 +03:00

264 lines
8.0 KiB
Plaintext

# Copyright 2007 Andy Tompkins.
# Copyright 2017 - 2022 James E. King III
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
local WERROR =
<toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on
<toolset>clang:<warnings-as-errors>on
;
local gcc-flags = -Wconversion -Wsign-conversion -Wshadow -Wundef ;
local clang-flags = $(gcc-flags) ;
project
: requirements
$(WERROR)
<toolset>gcc:<cxxflags>$(gcc-flags)
<toolset>clang:<cxxflags>$(clang-flags)
<library>/boost/uuid//boost_uuid
<library>/boost/core//boost_core
: default-build
<warnings>pedantic
;
import os ;
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
# on any other headers to be included first - adapted from
# logic in the winapi test bjam script
path-constant HERE : . ;
rule test_headers
{
local all_rules = ;
local file ;
local headers_path = [ path.make $(HERE)/../include/boost/uuid ] ;
for file in [ path.glob-tree $(headers_path) : *.hpp : uuid ]
{
local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
# Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
# All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
local decl_test_name = ~hdr-decl-$(test_name) ;
# ECHO $(rel_file) ;
all_rules += [ compile compile/decl_header.cpp : <define>"BOOST_UUID_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
}
# ECHO All rules: $(all_rules) ;
return $(all_rules) ;
}
alias test_headers : [ test_headers ] ;
# test including all .hpp files in 2 translation units
# to look for issues when using multiple translation units
# e.g. missing inline on a global function
run test_include1.cpp test_include2.cpp ;
# main tests
run test_uuid.cpp
: : : <library>/boost/container_hash//boost_container_hash ;
run test_uuid.cpp : : : <library>/boost/container_hash//boost_container_hash <define>BOOST_UUID_NO_SIMD : test_uuid_no_simd ;
run test_uuid_2.cpp ;
run test_uuid_3.cpp ;
# test type properties
run test_alignment.cpp ;
run test_alignment_2.cpp ;
run test_attribute_packed.cpp
: : : -$(WERROR) ;
run test_pragma_pack.cpp ;
run test_data.cpp ;
# test comparison
run test_comparison.cpp ;
run test_comparison.cpp : : : <define>BOOST_UUID_NO_SIMD : test_comparison_no_simd ;
# test uuid_io.hpp
run test_io.cpp
: : : <library>/boost/lexical_cast//boost_lexical_cast <library>/boost/predef//boost_predef -$(WERROR) ;
run test_io.cpp : : : <library>/boost/lexical_cast//boost_lexical_cast <library>/boost/predef//boost_predef <define>BOOST_UUID_NO_SIMD -$(WERROR) : test_io_no_simd ;
run test_io_2.cpp ;
run test_io_2.cpp : : : <define>BOOST_UUID_NO_SIMD : test_io_2_no_simd ;
run test_to_chars.cpp ;
run test_to_chars.cpp : : : <define>BOOST_UUID_NO_SIMD : test_to_chars_no_simd ;
run test_to_chars_2.cpp ;
run test_to_chars_2.cpp : : : <define>BOOST_UUID_NO_SIMD : test_to_chars_2_no_simd ;
run test_from_chars.cpp ;
run test_from_chars.cpp : : : <define>BOOST_UUID_NO_SIMD : test_from_chars_no_simd ;
run test_from_chars_2.cpp ;
run test_from_chars_2.cpp : : : <define>BOOST_UUID_NO_SIMD : test_from_chars_2_no_simd ;
run test_uuid_from_string.cpp ;
run test_uuid_from_string_2.cpp ;
# test uuid_clock
run test_uuid_clock.cpp ;
# test generators
run test_nil_generator.cpp ;
run test_string_generator.cpp ;
run test_string_generator_2.cpp ;
run test_random_generator.cpp : : : <library>/boost/random//boost_random <library>/boost/predef//boost_predef ;
run test_random_generator_2.cpp ;
run test_name_generator.cpp
: : : <library>/boost/predef//boost_predef ;
run test_namespaces.cpp ;
run test_name_generator_md5.cpp ;
run test_name_generator_sha1.cpp ;
lib atomic ;
run test_time_generator.cpp
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v1.cpp
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v1_2.cpp
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v1_3.cpp : : : <threading>multi
<toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v6.cpp
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v6_2.cpp
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v6_3.cpp : : : <threading>multi
<toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
<toolset>gcc-4.8,<address-model>32:<build>no ;
run test_time_generator_v7.cpp ;
run test_time_generator_v7_2.cpp ;
run test_time_generator_v7_3.cpp ;
# test serializing uuids
run test_serialization.cpp : : : <library>/boost/serialization//boost_serialization <undefined-sanitizer>norecover:<link>static -$(WERROR) ;
# run test_wserialization.cpp /boost/serialization//boost_serialization /boost/serialization//boost_wserialization ;
# test tagging an object
run test_tagging.cpp ;
# test use cases
run test_uuid_class.cpp ;
run test_uuid_in_map.cpp ;
# test hashing support
run test_hash.cpp
: : : <library>/boost/container_hash//boost_container_hash ;
run test_hash_value.cpp ;
run test_std_unordered.cpp ;
run test_boost_unordered.cpp : : : <toolset>gcc-4.7:<build>no <library>/boost/unordered//boost_unordered ;
# test detail components
run test_detail_md5.cpp ;
run test_detail_sha1.cpp ;
run test_detail_endian.cpp ;
run test_detail_chacha20.cpp ;
# compile-fail tests
compile-fail compile-fail/random_provider_no_copy_ctor.cpp : -$(WERROR) ;
compile-fail compile-fail/random_provider_no_copy_assign.cpp : -$(WERROR) ;
# test MSVC 12 (VS2013) optimizer bug with SIMD operations.
# See https://svn.boost.org/trac/boost/ticket/8509#comment:3
# Only happens in Release x64 builds.
run test_msvc_simd_bug981648_main.cpp test_msvc_simd_bug981648_foo.cpp : : : <variant>release <debug-symbols>on : test_msvc_simd_bug981648 ;
# a small benchmark test for random generation
run test_bench_random.cpp /boost/timer//boost_timer : : : <toolset>clang-cloudabi:<build>no ;
# tests for the header-only random provider
run test_entropy_error.cpp ;
run test_detail_random_provider.cpp
: : : <library>/boost/array//boost_array ;
# constants
run test_constants.cpp ;
# constexpr tests
compile test_uuid_cx.cpp ;
run test_uuid_cx2.cpp ;
run test_uuid_cx3.cpp ;
run test_uuid_cx3.cpp : : : <define>BOOST_UUID_NO_SIMD : test_uuid_cx3_no_simd ;
run test_hash_value_cx.cpp ;
run test_string_generator_cx.cpp ;
run test_string_generator_cx2.cpp ;
run test_constants_cx.cpp ;
run test_from_chars_cx.cpp ;
run test_from_chars_cx2.cpp ;
run test_to_chars_cx.cpp ;
run test_uuid_from_string_cx.cpp ;
# 'quick' test for CI
run quick.cpp ;