Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add threadPool unit tests to fuzzer.c #2604

Merged
merged 1 commit into from
May 7, 2021

Conversation

senhuang42
Copy link
Contributor

@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
@@ -3988,6 +4114,11 @@ int main(int argc, const char** argv)

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
Contributor 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 added 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