Skip to content

Add threadPool unit tests to fuzzer.c#2604

Merged
senhuang42 merged 1 commit intofacebook:devfrom
senhuang42:threadpool_test
May 7, 2021
Merged

Add threadPool unit tests to fuzzer.c#2604
senhuang42 merged 1 commit intofacebook:devfrom
senhuang42:threadpool_test

Conversation

@senhuang42
Copy link

@senhuang42 senhuang42 commented May 3, 2021

This PR adds threadPool API tests for basic functionality. We test pool re-use and simultaneous use (I think in practice these are pretty similar scenarios). It's gated behind ZSTD_MULTITHREAD.

We add a dependency to fuzzer.c in order to give us access to ZSTD_pthread_create/join, (which poolTests.c already includes too).

@senhuang42 senhuang42 force-pushed the threadpool_test branch 2 times, most recently from aca15e0 to 092e6dc Compare May 3, 2021 22:42
int err;
} threadPoolTests_compressionJob_payload;

static void* threadPoolTests_compressionJob(void* payload) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/fuzzer.c:350:14: error: ‘threadPoolTests_compressionJob’ defined but not used [-Werror=unused-function]
  350 | static void* threadPoolTests_compressionJob(void* payload) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

May need ZSTD_MULTITHREAD too.

@senhuang42 senhuang42 force-pushed the threadpool_test branch 2 times, most recently from 4a2ecee to 7e0259e Compare May 4, 2021 17:02
tests/fuzzer.c Outdated

if (nbTests < testNb) nbTests = testNb;

result = threadPoolTests();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This invocation of threadPoolTests() could be done inside basicUnitTests().
It would make it similar to other unit tests, which can be skipped on demand.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I've added it to the end of basicUnitTests().

@senhuang42 senhuang42 merged commit d8d6e48 into facebook:dev May 7, 2021
senhuang42 pushed a commit to senhuang42/zstd that referenced this pull request May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants