diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-10-11 17:16:39 +0200 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2017-10-11 17:18:18 +0200 |
commit | f877e365a42f8f34af6fc3382593ef09101a50d0 (patch) | |
tree | 9542bb14d96869f06c28c3b583e97dc2d2ba2e4c /src/test/libcephfs/test.cc | |
parent | lockdep: free_ids and lock_ref hashes must be truly global (diff) | |
download | ceph-f877e365a42f8f34af6fc3382593ef09101a50d0.tar.xz ceph-f877e365a42f8f34af6fc3382593ef09101a50d0.zip |
test: make the LibCephFS.ShutdownRacer test even more thrashy
Have each thread do the startup and shutdown in a loop for a specified
number of times.
Tracker: http://tracker.ceph.com/issues/21512
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'src/test/libcephfs/test.cc')
-rw-r--r-- | src/test/libcephfs/test.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index 5e4de0b55e2..957c7edc8dd 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -1862,23 +1862,26 @@ TEST(LibCephFS, OperationsOnRoot) ceph_shutdown(cmount); } -#define NTHREADS 128 - static void shutdown_racer_func() { + const int niter = 32; 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); + int i; + + for (i = 0; i < niter; ++i) { + 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]; + const int nthreads = 128; + std::thread threads[nthreads]; // Need a bunch of fd's for this test struct rlimit rold, rnew; @@ -1887,10 +1890,10 @@ TEST(LibCephFS, ShutdownRace) rnew.rlim_cur = rnew.rlim_max; ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &rnew), 0); - for (int i = 0; i < NTHREADS; ++i) + for (int i = 0; i < nthreads; ++i) threads[i] = std::thread(shutdown_racer_func); - for (int i = 0; i < NTHREADS; ++i) + for (int i = 0; i < nthreads; ++i) threads[i].join(); ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &rold), 0); } |