Skip to content

Commit

Permalink
Addressing nit picks
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelapla committed Feb 22, 2024
1 parent 6f0363d commit 0b585ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You can pass the following options to `cmake ..`
* `-DUNDEFINED_BEHAVIOR_SANITIZER` Build with UndefinedBehaviorSanitizer
* `-DBUILD_DEBUG_HEAP` Build debug heap with guard bands and validation. This is ONLY intended for low-level debugging purposes. Default is OFF
* `-DALIGNED_MEMORY_MODEL` Build for aligned memory model only devices. Default is OFF.
* `-DKVS_DEFAULT_STACK_SIZE` -- Value in bytes for default stack size of threads. Pthread minimum for Unix applications is 16kb
* `-DKVS_DEFAULT_STACK_SIZE` -- Value in bytes for default stack size of threads. Pthread minimum for Unix applications is 16 Kib

### Build
To build the library run make in the build directory you executed CMake.
Expand Down
22 changes: 21 additions & 1 deletion tst/utils/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ TEST_F(ThreadFunctionalityTest, ThreadCreateAndReleaseSimpleCheckWithStack)
UINT64 index;
TID threads[TEST_THREAD_COUNT];
gThreadMutex = MUTEX_CREATE(FALSE);
SIZE_T threadStack = 16 * 1024;
srand(GETTIME());
SIZE_T threadStack = 16 * 1024 + rand()%(500 * 1024);
struct sleep_times st[TEST_THREAD_COUNT];

gThreadCount = 0;
Expand Down Expand Up @@ -152,3 +153,22 @@ TEST_F(ThreadFunctionalityTest, ThreadCreateAndReleaseSimpleCheckWithStack)

MUTEX_FREE(gThreadMutex);
}

TEST_F(ThreadFunctionalityTest, NegativeTest)
{
UINT64 index;
TID threads[TEST_THREAD_COUNT];
gThreadMutex = MUTEX_CREATE(FALSE);
SIZE_T threadStack = 16 * 1024;
struct sleep_times st[TEST_THREAD_COUNT];

gThreadCount = 0;
EXPECT_NE(STATUS_SUCCESS, THREAD_CREATE_WITH_PARAMS(NULL, testThreadRoutine, threadStack, NULL));
EXPECT_NE(STATUS_SUCCESS, THREAD_CREATE(NULL, testThreadRoutine, NULL));

MUTEX_LOCK(gThreadMutex);
EXPECT_EQ(0, gThreadCount);
MUTEX_UNLOCK(gThreadMutex);

MUTEX_FREE(gThreadMutex);
}

0 comments on commit 0b585ce

Please sign in to comment.