mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 04:19:10 -04:00
test: add env variable to allow skipping slow tests in CI
This commit is contained in:
parent
2355aba67b
commit
c2513f4e81
@ -34,6 +34,11 @@ if [[ "$BUILD_TYPE" != "clang-release-ninja-static" ]]; then
|
||||
export DWARFS_LOCAL_REPO_PATH="$LOCAL_REPO_PATH"
|
||||
fi
|
||||
|
||||
if [[ "-$BUILD_TYPE-" == *-debug-* ]] && [[ "-$BUILD_TYPE-" != *-coverage-* ]] &&
|
||||
[[ "-$BUILD_TYPE-" != *-[at]san-* ]] && [[ "-$BUILD_TYPE-" != *-ubsan-* ]]; then
|
||||
export DWARFS_SKIP_SLOW_TESTS=1
|
||||
fi
|
||||
|
||||
cd "$HOME"
|
||||
|
||||
rm -rf dwarfs dwarfs-*
|
||||
|
@ -133,7 +133,9 @@ TEST(block_range, compressed) {
|
||||
::testing::HasSubstr("block_range: size out of range (101 > 100)")));
|
||||
}
|
||||
|
||||
class options_test : public ::testing::TestWithParam<block_cache_options> {};
|
||||
class options_test : public ::testing::TestWithParam<block_cache_options> {
|
||||
DWARFS_SLOW_FIXTURE
|
||||
};
|
||||
|
||||
TEST_P(options_test, cache_stress) {
|
||||
static constexpr size_t num_threads{8};
|
||||
|
@ -38,6 +38,9 @@
|
||||
|
||||
#include <dwarfs/writer/internal/multi_queue_block_merger.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
using namespace dwarfs::test;
|
||||
using namespace dwarfs::writer;
|
||||
|
||||
namespace {
|
||||
@ -46,6 +49,8 @@ constexpr int const debuglevel{0};
|
||||
|
||||
constexpr size_t const max_runs_regular{250};
|
||||
constexpr size_t const max_runs_partial{50};
|
||||
constexpr size_t const max_runs_regular_quick{25};
|
||||
constexpr size_t const max_runs_partial_quick{5};
|
||||
constexpr size_t const num_runner_threads{16};
|
||||
constexpr size_t const num_repetitions{4};
|
||||
|
||||
@ -469,9 +474,11 @@ block_merger_test(size_t const max_runs) {
|
||||
TEST(block_merger, random) {
|
||||
using merger_type = internal::multi_queue_block_merger<size_t, block>;
|
||||
|
||||
auto [passes, fails] = block_merger_test<merger_type>(max_runs_regular);
|
||||
auto max_runs = skip_slow_tests() ? max_runs_regular_quick : max_runs_regular;
|
||||
|
||||
EXPECT_EQ(max_runs_regular * num_repetitions, passes);
|
||||
auto [passes, fails] = block_merger_test<merger_type>(max_runs);
|
||||
|
||||
EXPECT_EQ(max_runs * num_repetitions, passes);
|
||||
EXPECT_TRUE(fails.empty()) << folly::join(", ", fails);
|
||||
}
|
||||
|
||||
@ -480,9 +487,11 @@ TEST(block_merger, random_sized) {
|
||||
internal::multi_queue_block_merger<size_t, sized_block,
|
||||
sized_block_merger_policy>;
|
||||
|
||||
auto [passes, fails] = block_merger_test<merger_type>(max_runs_regular);
|
||||
auto max_runs = skip_slow_tests() ? max_runs_regular_quick : max_runs_regular;
|
||||
|
||||
EXPECT_EQ(max_runs_regular * num_repetitions, passes);
|
||||
auto [passes, fails] = block_merger_test<merger_type>(max_runs);
|
||||
|
||||
EXPECT_EQ(max_runs * num_repetitions, passes);
|
||||
EXPECT_TRUE(fails.empty()) << folly::join(", ", fails);
|
||||
}
|
||||
|
||||
@ -491,8 +500,10 @@ TEST(block_merger, random_sized_partial) {
|
||||
internal::multi_queue_block_merger<size_t, sized_block,
|
||||
sized_block_merger_policy>;
|
||||
|
||||
auto [passes, fails] = block_merger_test<merger_type, true>(max_runs_partial);
|
||||
auto max_runs = skip_slow_tests() ? max_runs_partial_quick : max_runs_partial;
|
||||
|
||||
EXPECT_EQ(max_runs_partial * num_repetitions, passes);
|
||||
auto [passes, fails] = block_merger_test<merger_type, true>(max_runs);
|
||||
|
||||
EXPECT_EQ(max_runs * num_repetitions, passes);
|
||||
EXPECT_TRUE(fails.empty()) << folly::join(", ", fails);
|
||||
}
|
||||
|
@ -576,6 +576,7 @@ std::vector<std::string> const compressions{
|
||||
class compression_test
|
||||
: public testing::TestWithParam<std::tuple<
|
||||
std::string, unsigned, file_order_mode, std::optional<std::string>>> {
|
||||
DWARFS_SLOW_FIXTURE
|
||||
};
|
||||
|
||||
class scanner_test : public testing::TestWithParam<
|
||||
@ -857,7 +858,9 @@ INSTANTIATE_TEST_SUITE_P(dwarfs, compression_regression,
|
||||
|
||||
class file_scanner
|
||||
: public testing::TestWithParam<
|
||||
std::tuple<file_order_mode, std::optional<std::string>>> {};
|
||||
std::tuple<file_order_mode, std::optional<std::string>>> {
|
||||
DWARFS_SLOW_FIXTURE
|
||||
};
|
||||
|
||||
TEST_P(file_scanner, inode_ordering) {
|
||||
auto [order_mode, file_hash_algo] = GetParam();
|
||||
|
@ -214,6 +214,8 @@ std::string valid_v2_header(uint32_t section_number = 0) {
|
||||
} // namespace
|
||||
|
||||
TEST(filesystem, find_image_offset) {
|
||||
DWARFS_SLOW_TEST();
|
||||
|
||||
test::test_logger lgr;
|
||||
test::os_access_mock os;
|
||||
|
||||
|
@ -583,4 +583,9 @@ std::string create_random_string(size_t size, size_t seed) {
|
||||
return create_random_string(size, tmprng);
|
||||
}
|
||||
|
||||
bool skip_slow_tests() {
|
||||
static bool skip = getenv_is_enabled("DWARFS_SKIP_SLOW_TESTS");
|
||||
return skip;
|
||||
}
|
||||
|
||||
} // namespace dwarfs::test
|
||||
|
@ -365,4 +365,16 @@ std::string create_random_string(size_t size, uint8_t min, uint8_t max,
|
||||
std::string create_random_string(size_t size, std::mt19937_64& gen);
|
||||
std::string create_random_string(size_t size, size_t seed = 0);
|
||||
|
||||
bool skip_slow_tests();
|
||||
|
||||
#define DWARFS_SLOW_TEST() \
|
||||
do { \
|
||||
if (::dwarfs::test::skip_slow_tests()) { \
|
||||
GTEST_SKIP() << "skipping slow test"; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DWARFS_SLOW_FIXTURE \
|
||||
void SetUp() override { DWARFS_SLOW_TEST(); }
|
||||
|
||||
} // namespace dwarfs::test
|
||||
|
@ -1478,7 +1478,9 @@ INSTANTIATE_TEST_SUITE_P(dwarfs, mkdwarfs_recompress_test,
|
||||
::testing::ValuesIn(source_fs_compression));
|
||||
|
||||
class mkdwarfs_build_options_test
|
||||
: public testing::TestWithParam<std::string_view> {};
|
||||
: public testing::TestWithParam<std::string_view> {
|
||||
DWARFS_SLOW_FIXTURE
|
||||
};
|
||||
|
||||
TEST_P(mkdwarfs_build_options_test, basic) {
|
||||
auto opts = GetParam();
|
||||
@ -1669,6 +1671,8 @@ constexpr std::array<std::string_view, 9> const pack_mode_names = {
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, pack_modes_random) {
|
||||
DWARFS_SLOW_TEST();
|
||||
|
||||
std::mt19937_64 rng{42};
|
||||
std::uniform_int_distribution<> dist{1, pack_mode_names.size()};
|
||||
|
||||
@ -1848,7 +1852,9 @@ TEST(mkdwarfs_test, compression_cannot_be_used_for_category) {
|
||||
}
|
||||
#endif
|
||||
|
||||
class mkdwarfs_progress_test : public testing::TestWithParam<char const*> {};
|
||||
class mkdwarfs_progress_test : public testing::TestWithParam<char const*> {
|
||||
DWARFS_SLOW_FIXTURE
|
||||
};
|
||||
|
||||
TEST_P(mkdwarfs_progress_test, basic) {
|
||||
std::string mode{GetParam()};
|
||||
@ -2471,6 +2477,7 @@ TEST(mkdwarfs_test, filesystem_read_error) {
|
||||
}
|
||||
|
||||
class segmenter_repeating_sequence_test : public testing::TestWithParam<char> {
|
||||
DWARFS_SLOW_FIXTURE
|
||||
};
|
||||
|
||||
TEST_P(segmenter_repeating_sequence_test, github161) {
|
||||
|
@ -1055,12 +1055,15 @@ TEST_P(tools_test, end_to_end) {
|
||||
"-oenable_nlink",
|
||||
"-oreadonly",
|
||||
#endif
|
||||
"-omlock=try",
|
||||
"-ono_cache_image",
|
||||
"-ocache_files",
|
||||
"-otidy_strategy=time",
|
||||
};
|
||||
|
||||
if (!dwarfs::test::skip_slow_tests()) {
|
||||
all_options.push_back("-omlock=try");
|
||||
all_options.push_back("-ono_cache_image");
|
||||
all_options.push_back("-ocache_files");
|
||||
all_options.push_back("-otidy_strategy=time");
|
||||
}
|
||||
|
||||
unsigned const combinations = 1 << all_options.size();
|
||||
|
||||
for (unsigned bitmask = 0; bitmask < combinations; ++bitmask) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user