Skip to content

Commit 6504891

Browse files
SchrodingerZhugithub-actions[bot]
authored andcommitted
Automerge: Revert "[libc][test] split exit tests into two separate tests" (#168102)
Reverts llvm/llvm-project#166355
2 parents 87ce7cd + 5b798df commit 6504891

File tree

6 files changed

+8
-62
lines changed

6 files changed

+8
-62
lines changed

libc/cmake/modules/LLVMLibCArchitectures.cmake

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -215,37 +215,6 @@ else()
215215
"Unsupported libc target operating system ${LIBC_TARGET_OS}")
216216
endif()
217217

218-
# If the compiler target triple is not the same as the triple specified by
219-
# LIBC_TARGET_TRIPLE or LLVM_RUNTIMES_TARGET, we will add a --target option
220-
# if the compiler is clang. If the compiler is GCC we just error out as there
221-
# is no equivalent of an option like --target.
222-
if(explicit_target_triple AND
223-
(NOT (libc_compiler_triple STREQUAL explicit_target_triple)))
224-
set(LIBC_CROSSBUILD TRUE)
225-
if(CMAKE_COMPILER_IS_GNUCXX)
226-
message(FATAL_ERROR
227-
"GCC target triple (${libc_compiler_triple}) and the explicity "
228-
"specified target triple (${explicit_target_triple}) do not match.")
229-
else()
230-
list(APPEND
231-
LIBC_COMPILE_OPTIONS_DEFAULT "--target=${explicit_target_triple}")
232-
endif()
233-
endif()
234-
235-
if(LIBC_TARGET_OS_IS_DARWIN)
236-
execute_process(
237-
COMMAND xcrun --sdk macosx --show-sdk-path
238-
OUTPUT_VARIABLE MACOSX_SDK_PATH
239-
RESULT_VARIABLE MACOSX_SDK_PATH_RESULT
240-
OUTPUT_STRIP_TRAILING_WHITESPACE
241-
)
242-
if(MACOSX_SDK_PATH_RESULT EQUAL 0)
243-
list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT "-I" "${MACOSX_SDK_PATH}/usr/include")
244-
else()
245-
message(WARNING "Could not find macOS SDK path. `xcrun --sdk macosx --show-sdk-path` failed.")
246-
endif()
247-
endif()
248-
249218
# Windows does not support full mode build.
250219
if (LIBC_TARGET_OS_IS_WINDOWS AND LLVM_LIBC_FULL_BUILD)
251220
message(FATAL_ERROR "Windows does not support full mode build.")

libc/include/sys/syscall.h.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_LIBC_SYS_SYSCALL_H
1010
#define LLVM_LIBC_SYS_SYSCALL_H
1111

12-
#if defined(__linux__)
12+
//TODO: Handle non-linux syscalls
1313

1414
#include <asm/unistd.h>
1515

@@ -2361,6 +2361,5 @@
23612361
#define SYS_writev __NR_writev
23622362
#endif
23632363

2364-
#endif // __linux__
23652364

23662365
#endif // LLVM_LIBC_SYS_SYSCALL_H

libc/test/UnitTest/ExecuteFunctionUnix.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ ProcessStatus invoke_in_subprocess(FunctionCaller *func, int timeout_ms) {
5757
}
5858
::close(pipe_fds[1]);
5959

60-
pollfd poll_fd{pipe_fds[0], POLLIN, 0};
60+
struct pollfd poll_fd {
61+
pipe_fds[0], 0, 0
62+
};
6163
// No events requested so this call will only return after the timeout or if
6264
// the pipes peer was closed, signaling the process exited.
6365
if (::poll(&poll_fd, 1, timeout_ms) == -1) {

libc/test/src/stdlib/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,19 +398,6 @@ if(LLVM_LIBC_FULL_BUILD)
398398
libc-stdlib-tests
399399
SRCS
400400
_Exit_test.cpp
401-
DEPENDS
402-
libc.src.__support.OSUtil.osutil
403-
libc.src.stdlib._Exit
404-
)
405-
406-
add_libc_test(
407-
exit_test
408-
# The EXPECT_EXITS test is only availible for unit tests.
409-
UNIT_TEST_ONLY
410-
SUITE
411-
libc-stdlib-tests
412-
SRCS
413-
exit_test.cpp
414401
DEPENDS
415402
libc.src.stdlib._Exit
416403
libc.src.stdlib.exit

libc/test/src/stdlib/_Exit_test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/stdlib/_Exit.h"
10+
#include "src/stdlib/exit.h"
1011
#include "test/UnitTest/Test.h"
1112

1213
TEST(LlvmLibcStdlib, _Exit) {
1314
EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(1); }, 1);
1415
EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(65); }, 65);
16+
17+
EXPECT_EXITS([] { LIBC_NAMESPACE::exit(1); }, 1);
18+
EXPECT_EXITS([] { LIBC_NAMESPACE::exit(65); }, 65);
1519
}

libc/test/src/stdlib/exit_test.cpp

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)