Commit 8e0bf02d by bernhard-gatzhammer

Removed single write multiple reader shared mutex test.

This test should test the try_lock for writing and assumed that it
would always succeed if there is only one writer and multiple
readers. However, this assumption was wrong. The documentation has
already been adapted and committed before.

EMBB-453
parent c8a7b041
...@@ -48,13 +48,6 @@ SharedMutexTest::SharedMutexTest() ...@@ -48,13 +48,6 @@ SharedMutexTest::SharedMutexTest()
.Add(&SharedMutexTest::TestExclusiveWriterWriterMethod, this, .Add(&SharedMutexTest::TestExclusiveWriterWriterMethod, this,
num_threads_ / 2, num_iterations_) num_threads_ / 2, num_iterations_)
.Post(&SharedMutexTest::TestExclusiveWriterPost, this); .Post(&SharedMutexTest::TestExclusiveWriterPost, this);
// CreateUnit("Single writer")
// .Pre(&SharedMutexTest::TestSingleWriterPre, this)
// .Add(&SharedMutexTest::TestSingleWriterReaderMethod, this,
// num_threads_, num_iterations_)
// .Add(&SharedMutexTest::TestSingleWriterWriterMethod, this,
// 1, num_iterations_)
// .Post(&SharedMutexTest::TestSingleWriterPost, this);
} }
void SharedMutexTest::TestSharedReadPre() { void SharedMutexTest::TestSharedReadPre() {
...@@ -113,38 +106,6 @@ void SharedMutexTest::TestExclusiveWriterPost() { ...@@ -113,38 +106,6 @@ void SharedMutexTest::TestExclusiveWriterPost() {
embb_shared_mutex_destroy(&shared_mutex_); embb_shared_mutex_destroy(&shared_mutex_);
} }
//void SharedMutexTest::TestSingleWriterPre() {
// int success = embb_shared_mutex_init(&shared_mutex_);
// PT_ASSERT_EQ_MSG(success, EMBB_SUCCESS, "Failed to initialize shared mutex.");
//
// counter_ = 0;
//}
//void SharedMutexTest::TestSingleWriterReaderMethod() {
// // Just add some contention
//
// int success = embb_shared_mutex_lock_shared(&shared_mutex_);
// PT_ASSERT_EQ_MSG(success, EMBB_SUCCESS, "Failed to lock for reading.");
//
// success = embb_shared_mutex_unlock_shared(&shared_mutex_);
// PT_ASSERT_EQ_MSG(success, EMBB_SUCCESS, "Failed to unlock (reading).");
//}
//
//void SharedMutexTest::TestSingleWriterWriterMethod() {
// int success = embb_shared_mutex_lock(&shared_mutex_);
// PT_ASSERT_EQ_MSG(success, EMBB_SUCCESS, "Failed to lock for writing.");
//
// ++counter_;
//
// success = embb_shared_mutex_unlock(&shared_mutex_);
// PT_ASSERT_EQ_MSG(success, EMBB_SUCCESS, "Failed to unlock (writing).");
//}
//
//void SharedMutexTest::TestSingleWriterPost() {
// PT_ASSERT_EQ_MSG(counter_, num_iterations_, "Counter value is inconsistent.");
// embb_shared_mutex_destroy(&shared_mutex_);
//}
} // namespace test } // namespace test
} // namespace base } // namespace base
} // namespace embb } // namespace embb
...@@ -63,18 +63,6 @@ class SharedMutexTest : public partest::TestCase { ...@@ -63,18 +63,6 @@ class SharedMutexTest : public partest::TestCase {
void TestExclusiveWriterWriterMethod(); void TestExclusiveWriterWriterMethod();
void TestExclusiveWriterPost(); void TestExclusiveWriterPost();
// /**
// * Multiple readers, single writer.
// *
// * The single writer uses try_lock() and tests if that always obtains the
// * lock. The readers use lock_shared() and test if that always obtains the
// * shared lock (after waiting).
// */
// void TestSingleWriterPre();
// void TestSingleWriterReaderMethod();
// void TestSingleWriterWriterMethod();
// void TestSingleWriterPost();
embb_shared_mutex_t shared_mutex_; embb_shared_mutex_t shared_mutex_;
size_t counter_; size_t counter_;
size_t num_threads_; size_t num_threads_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment