Bug #20988 ยป 0001-client-test-shutdown-race.patch
src/test/libcephfs/test.cc | ||
---|---|---|
#include <map>
|
||
#include <vector>
|
||
#include <thread>
|
||
TEST(LibCephFS, OpenEmptyComponent) {
|
||
... | ... | |
ceph_shutdown(cmount);
|
||
}
|
||
#define NTHREADS 128
|
||
static void shutdown_racer_func()
|
||
{
|
||
struct ceph_mount_info *cmount;
|
||
ASSERT_EQ(ceph_create(&cmount, NULL), 0);
|
||
ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
|
||
ASSERT_EQ(0, ceph_conf_parse_env(cmount, NULL));
|
||
ASSERT_EQ(ceph_mount(cmount, "/"), 0);
|
||
ceph_shutdown(cmount);
|
||
}
|
||
// See tracker #20988
|
||
TEST(LibCephFS, ShutdownRace)
|
||
{
|
||
std::thread threads[NTHREADS];
|
||
for (int i = 0; i < NTHREADS; ++i)
|
||
threads[i] = std::thread(shutdown_racer_func);
|
||
for (int i = 0; i < NTHREADS; ++i)
|
||
threads[i].join();
|
||
}
|