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

fix #4312 - musl compilation compatibility #4336

Merged
merged 6 commits into from
Mar 12, 2025
Merged

Conversation

Cyan4973
Copy link
Contributor

@Cyan4973 Cyan4973 commented Mar 11, 2025

#4312 tried to implement a manual workaround for musl compilation issues.
It's manual because musl does not provide a version number, making it difficult to automate decisions.

Unfortunately, the fix was incomplete, and the test did not catch it because it only detected a "warning" and had no runtime error.
Fixed both the test, which will now fail both at run time and compile time under similar conditions,
and the code, which now passes the more stringent test.

Used the opportunity to restructure the code, so that the dispatch strategy among the different variants of qsort*() is more maintainable and extendable.
Employed the new framework to add support for C11 Annex K qsort_s() re-entrant variant.

also:
Reduced the duration of long CLI tests, particularly dictionary building tests, by utilizing multithreading with the -T0 flag. This optimization significantly decreases the execution time of the longest CI jobs, enhancing overall CI efficiency and throughput.

@Cyan4973 Cyan4973 changed the title attempt to reduce length of long cli tests by invoking -T0 attempt to reduce duration of long cli tests with multithreading Mar 11, 2025
@Cyan4973 Cyan4973 self-assigned this Mar 11, 2025
@Cyan4973
Copy link
Contributor Author

And indeed, it helps a bit:
the longest test, clang-msan-testzstd went down, from 28mn to 19mn.
So this will help improving CI velocity.

@Cyan4973 Cyan4973 changed the title attempt to reduce duration of long cli tests with multithreading fix #4312 - musl compilation compatibility Mar 11, 2025
@Cyan4973 Cyan4973 marked this pull request as ready for review March 11, 2025 21:08
Cyan4973 and others added 5 commits March 11, 2025 14:10
and upgraded the test so that it would fail, both at compile time and at run time, without the fix
centralizes auto detection tests,
then distribute the outcome in all the places where it's active.
standard defined re-entrant variant of qsort().
Unfortunately, Annex K is optional.
Comment on lines 369 to 371
* Note(@cyan): qsort() is never guaranteed to be stable,
* so why would this property only matter for OpenBSD ?
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can drop this. This was added before we switched to use COVER_strict_cmp* which enforces a strict ordering on the array.

@Cyan4973 Cyan4973 merged commit eca205f into facebook:dev Mar 12, 2025
101 checks passed
@iucoen
Copy link

iucoen commented Mar 12, 2025

g_coverCtx can be declared as thread local so this code will at least be thread-safe on older versions of musl

@Cyan4973
Copy link
Contributor Author

In C11 yes, but not in C90.

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