#
# Copyright (c) 2019-2024 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#

import os ;

# The hostname to use for tests
local hostname = [ os.environ BOOST_MYSQL_SERVER_HOST ] ;
if $(hostname) = ""
{
    hostname = "127.0.0.1" ;
}

# TSAN can't be enabled in our ARM CIs, since they fail
# the personality() syscall to disable address space layout randomization.
# In OSX, tsan reports a race condition in Asio's kqueue reactor. Ignore this for now.
# gcc-13 complains about TSAN not supporting std::atomic_thread_fence, which is used by Asio.
# However, this doesn't seem to affect TSAN results
rule tsan_if_not_arm ( properties * )
{
    local result ;
    if ! <architecture>arm in $(properties) && ! <target-os>darwin in $(properties) && ! <toolset-gcc:version>13 in $(properties)
    {
        result += <thread-sanitizer>norecover ;
    }
    return $(result) ;
}

run
        /boost/mysql/test//boost_mysql_compiled
        connection_pool.cpp
    : requirements
        <testing.arg>$(hostname)
        <conditional>@tsan_if_not_arm
    : target-name boost_mysql_thread_safety
;
