@@ -55,6 +55,20 @@ typedef boost::mt11213b gen_type;
5555const uint64_t DEF_STORE_TEST_BLOCKDEV_SIZE = 10240000000 ;
5656#define dout_context g_ceph_context
5757
58+ static uint64_t get_testing_seed (const char * function) {
59+ char * random_seed = getenv (" TEST_RANDOM_SEED" );
60+ uint64_t testing_seed;
61+ if (random_seed) {
62+ testing_seed = atoi (random_seed);
63+ } else {
64+ testing_seed = time (NULL );
65+ }
66+ cout << " seed for " << function << " is " << testing_seed << std::endl;
67+ return testing_seed;
68+ }
69+
70+ #define TEST_RANDOM_SEED get_testing_seed (__func__)
71+
5872static bool bl_eq(bufferlist& expected, bufferlist& actual)
5973{
6074 if (expected.contents_equal (actual))
@@ -785,7 +799,7 @@ TEST_P(StoreTest, SimpleColPreHashTest) {
785799 uint32_t pg_num = 128 ;
786800
787801 boost::uniform_int<> pg_id_range (0 , pg_num);
788- gen_type rng (time ( NULL ) );
802+ gen_type rng (TEST_RANDOM_SEED );
789803 int pg_id = pg_id_range (rng);
790804
791805 int objs_per_folder = abs (merge_threshold) * 16 * g_ceph_context->_conf ->filestore_split_multiple ;
@@ -5175,7 +5189,7 @@ void StoreTest::doSyntheticTest(
51755189 uint64_t max_obj, uint64_t max_wr, uint64_t align)
51765190{
51775191 MixedGenerator gen (555 );
5178- gen_type rng (time ( NULL ) );
5192+ gen_type rng (TEST_RANDOM_SEED );
51795193 coll_t cid (spg_t (pg_t (0 ,555 ), shard_id_t ::NO_SHARD));
51805194
51815195 SetVal (g_conf (), " bluestore_fsck_on_mount" , " false" );
@@ -5232,7 +5246,7 @@ void StoreTest::doSyntheticLimitedTest(
52325246 uint64_t max_obj, uint64_t max_wr, uint64_t align)
52335247{
52345248 MixedGenerator gen (555 );
5235- gen_type rng (time ( NULL ) );
5249+ gen_type rng (TEST_RANDOM_SEED );
52365250 coll_t cid (spg_t (pg_t (0 ,555 ), shard_id_t ::NO_SHARD));
52375251
52385252 SetVal (g_conf (), " bluestore_fsck_on_mount" , " false" );
@@ -5506,7 +5520,7 @@ TEST_P(StoreTestSpecificAUSize, SyntheticMatrixPreferDeferred) {
55065520
55075521TEST_P (StoreTest, AttrSynthetic) {
55085522 MixedGenerator gen (447 );
5509- gen_type rng (time ( NULL ) );
5523+ gen_type rng (TEST_RANDOM_SEED );
55105524 coll_t cid (spg_t (pg_t (0 ,447 ),shard_id_t ::NO_SHARD));
55115525
55125526 SyntheticWorkloadState test_obj (store.get (), &gen, &rng, cid, 40 *1024 , 4 *1024 , 0 );
@@ -7185,7 +7199,7 @@ void doMany4KWritesTest(ObjectStore* store,
71857199 unsigned write_alignment)
71867200{
71877201 MixedGenerator gen (555 );
7188- gen_type rng (time ( NULL ) );
7202+ gen_type rng (TEST_RANDOM_SEED );
71897203 coll_t cid (spg_t (pg_t (0 ,555 ), shard_id_t ::NO_SHARD));
71907204 store_statfs_t res_stat;
71917205
@@ -10464,7 +10478,7 @@ void doManySetAttr(ObjectStore* store,
1046410478 std::function<void (ObjectStore*)> do_check_fn)
1046510479{
1046610480 MixedGenerator gen (447 );
10467- gen_type rng (time ( NULL ) );
10481+ gen_type rng (TEST_RANDOM_SEED );
1046810482 coll_t cid (spg_t (pg_t (0 , 447 ), shard_id_t ::NO_SHARD));
1046910483
1047010484 SyntheticWorkloadState test_obj (store, &gen, &rng, cid, 0 , 0 , 0 );
0 commit comments