diff --git a/configure.py b/configure.py index d27d2d36d6..a64d757125 100755 --- a/configure.py +++ b/configure.py @@ -1909,7 +1909,7 @@ with open(buildfile, 'w') as f: if binary not in tests_not_using_seastar_test_framework: local_libs += ' ' + "$seastar_testing_libs_{}".format(mode) else: - local_libs += ' ' + '-lgnutls' + local_libs += ' ' + '-lgnutls' + ' ' + '-lboost_unit_test_framework' # Our code's debugging information is huge, and multiplied # by many tests yields ridiculous amounts of disk space. # So we strip the tests by default; The user can very diff --git a/test.py b/test.py index 8cd56e2610..de1a3cced2 100755 --- a/test.py +++ b/test.py @@ -1032,6 +1032,7 @@ async def run_test(test: Test, options: argparse.Namespace, gentle_kill=False, e # TMPDIR env variable is used by any seastar/scylla # test for directory to store test temporary data. TMPDIR=os.path.join(options.tmpdir, test.mode), + SCYLLA_TEST_ENV='yes', **env, ), preexec_fn=os.setsid, diff --git a/test/boost/sstable_datafile_test.cc b/test/boost/sstable_datafile_test.cc index 7ab4c86c0a..44f120d973 100644 --- a/test/boost/sstable_datafile_test.cc +++ b/test/boost/sstable_datafile_test.cc @@ -60,6 +60,7 @@ #include "test/lib/reader_concurrency_semaphore.hh" #include "test/lib/sstable_utils.hh" #include "test/lib/random_utils.hh" +#include "test/lib/test_utils.hh" #include "readers/from_mutations_v2.hh" #include "readers/from_fragments_v2.hh" #include "test/lib/random_schema.hh" @@ -301,7 +302,7 @@ SEASTAR_TEST_CASE(datafile_generation_16) { return test_datafile_generation_16({}); } -SEASTAR_TEST_CASE(datafile_generation_16_s3) { +SEASTAR_TEST_CASE(datafile_generation_16_s3, *boost::unit_test::precondition(tests::has_scylla_test_env)) { return test_datafile_generation_16(test_env_config{ .storage = make_test_object_storage_options() }); } diff --git a/test/boost/sstable_resharding_test.cc b/test/boost/sstable_resharding_test.cc index dcaeae57a5..69298bec58 100644 --- a/test/boost/sstable_resharding_test.cc +++ b/test/boost/sstable_resharding_test.cc @@ -19,6 +19,7 @@ #include "test/lib/key_utils.hh" #include "test/lib/sstable_utils.hh" #include "test/lib/test_services.hh" +#include "test/lib/test_utils.hh" #include "service/storage_proxy.hh" #include "db/config.hh" @@ -143,7 +144,7 @@ SEASTAR_TEST_CASE(sstable_resharding_test) { }); } -SEASTAR_TEST_CASE(sstable_resharding_over_s3_test) { +SEASTAR_TEST_CASE(sstable_resharding_over_s3_test, *boost::unit_test::precondition(tests::has_scylla_test_env)) { return sstables::test_env::do_with_async([] (auto& env) { run_sstable_resharding_test(env); }, test_env_config{ .storage = make_test_object_storage_options() }); diff --git a/test/lib/test_utils.cc b/test/lib/test_utils.cc index f386ee2fcc..247f15c54b 100644 --- a/test/lib/test_utils.cc +++ b/test/lib/test_utils.cc @@ -51,6 +51,17 @@ void fail(std::string_view msg, std::source_location sl) { throw_with_backtrace(format_msg(__FUNCTION__, false, sl, msg)); } + +extern boost::test_tools::assertion_result has_scylla_test_env(boost::unit_test::test_unit_id) { + if (::getenv("SCYLLA_TEST_ENV")) { + return true; + } + + testlog.info("Test environment is not configured. " + "Check test/pylib/minio_server.py for an example of how to configure the environment for it to run."); + return false; +} + } sstring make_random_string(size_t size) { diff --git a/test/lib/test_utils.hh b/test/lib/test_utils.hh index e30e6ffb4a..ceb7264233 100644 --- a/test/lib/test_utils.hh +++ b/test/lib/test_utils.hh @@ -11,7 +11,7 @@ #include #include "utils/source_location-compat.hh" #include - +#include #include // Thread safe alternatives to BOOST_REQUIRE_*, BOOST_CHECK_* and BOOST_FAIL(). @@ -55,4 +55,6 @@ inline std::string getenv_safe(std::string_view name) { return std::string(v); } +extern boost::test_tools::assertion_result has_scylla_test_env(boost::unit_test::test_unit_id); + }