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

[libc] fix test build on platforms without SYS_fork #94087

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

SchrodingerZhu
Copy link
Contributor

No description provided.

@SchrodingerZhu SchrodingerZhu requested a review from lntue June 1, 2024 02:25
@llvmbot llvmbot added the libc label Jun 1, 2024
@llvmbot
Copy link

llvmbot commented Jun 1, 2024

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/94087.diff

1 Files Affected:

  • (modified) libc/test/src/__support/threads/linux/raw_mutex_test.cpp (+4)
diff --git a/libc/test/src/__support/threads/linux/raw_mutex_test.cpp b/libc/test/src/__support/threads/linux/raw_mutex_test.cpp
index 814f6f14c87b9..aff6c8be0cb1b 100644
--- a/libc/test/src/__support/threads/linux/raw_mutex_test.cpp
+++ b/libc/test/src/__support/threads/linux/raw_mutex_test.cpp
@@ -63,7 +63,11 @@ TEST(LlvmLibcSupportThreadsRawMutexTest, PSharedLock) {
   shared->data = 0;
   LIBC_NAMESPACE::RawMutex::init(&shared->mutex);
   // Avoid pull in our own implementation of pthread_t.
+#ifdef SYS_fork
   long pid = LIBC_NAMESPACE::syscall_impl<long>(SYS_fork);
+#elif defined(SYS_clone)
+  long pid = LIBC_NAMESPACE::syscall_impl<long>(SYS_clone, SIGCHLD, 0);
+#endif
   for (int i = 0; i < 10000; ++i) {
     shared->mutex.lock(LIBC_NAMESPACE::cpp::nullopt, true);
     shared->data++;

@SchrodingerZhu SchrodingerZhu merged commit 8057756 into llvm:main Jun 1, 2024
6 of 7 checks passed
@SchrodingerZhu SchrodingerZhu deleted the origin/main-2 branch June 1, 2024 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants