Skip to content

Commit

Permalink
[libc] Use the new style includes for tests
Browse files Browse the repository at this point in the history
This is a follow up to D154529 covering tests.

Differential Revision: https://reviews.llvm.org/D154746
  • Loading branch information
petrhosek committed Jul 8, 2023
1 parent 661d91a commit fb149e4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion libc/test/src/signal/kill_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

#include "src/signal/kill.h"

#include "include/sys/syscall.h" // For syscall numbers.
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"

#include <signal.h>
#include <sys/syscall.h> // For syscall numbers.

using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;

Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/signal/raise_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "src/signal/raise.h"

#include "test/UnitTest/Test.h"

#include <signal.h>

TEST(LlvmLibcSignalTest, Raise) {
// SIGCONT is ingored unless stopped, so we can use it to check the return
// value of raise without needing to block.
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/signal/sigaddset_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "src/signal/sigaddset.h"

#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"

#include <errno.h>
#include <signal.h>

// This tests invalid inputs and ensures errno is properly set.
TEST(LlvmLibcSignalTest, SigaddsetInvalid) {
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/signal/sigdelset_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "src/signal/raise.h"
#include "src/signal/sigdelset.h"
#include "src/signal/sigfillset.h"
Expand All @@ -16,6 +15,7 @@
#include "test/UnitTest/Test.h"

#include <errno.h>
#include <signal.h>

TEST(LlvmLibcSigdelset, Invalid) {
using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/signal/sigfillset_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "src/signal/raise.h"
#include "src/signal/sigfillset.h"
#include "src/signal/sigprocmask.h"
Expand All @@ -15,6 +14,7 @@
#include "test/UnitTest/Test.h"

#include <errno.h>
#include <signal.h>

TEST(LlvmLibcSigfillset, Invalid) {
using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/signal/signal_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "src/errno/libc_errno.h"
#include "src/signal/raise.h"
#include "src/signal/signal.h"

#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"

#include <signal.h>

using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;

Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/signal/sigprocmask_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "src/errno/libc_errno.h"
#include "src/signal/raise.h"
#include "src/signal/sigaddset.h"
Expand All @@ -16,6 +15,8 @@
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"

#include <signal.h>

class LlvmLibcSignalTest : public __llvm_libc::testing::Test {
sigset_t oldSet;

Expand Down
3 changes: 2 additions & 1 deletion libc/test/src/stdlib/_Exit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
//
//===----------------------------------------------------------------------===//

#include "include/stdlib.h"
#include "src/stdlib/_Exit.h"
#include "src/stdlib/exit.h"
#include "test/UnitTest/Test.h"

#include <stdlib.h>

TEST(LlvmLibcStdlib, _Exit) {
EXPECT_EXITS([] { __llvm_libc::_Exit(1); }, 1);
EXPECT_EXITS([] { __llvm_libc::_Exit(65); }, 65);
Expand Down
5 changes: 3 additions & 2 deletions libc/test/src/stdlib/abort_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
//
//===----------------------------------------------------------------------===//

#include "include/signal.h"
#include "include/stdlib.h"
#include "src/stdlib/abort.h"
#include "test/UnitTest/Test.h"

#include <signal.h>
#include <stdlib.h>

TEST(LlvmLibcStdlib, abort) {
// -1 matches against any signal, which is necessary for now until
// __llvm_libc::abort() unblocks SIGABRT.
Expand Down

0 comments on commit fb149e4

Please sign in to comment.