Skip to content

Commit 0d420f1

Browse files
committed
Reduce libc_errno usage in tan smoke tests.
1 parent ae8bfa9 commit 0d420f1

File tree

7 files changed

+12
-25
lines changed

7 files changed

+12
-25
lines changed

libc/test/src/math/smoke/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ add_fp_unittest(
117117
SRCS
118118
tanf_test.cpp
119119
DEPENDS
120-
libc.src.errno.errno
120+
libc.hdr.errno_macros
121121
libc.src.math.tanf
122122
libc.src.__support.CPP.array
123123
libc.src.__support.FPUtil.fp_bits
@@ -130,7 +130,7 @@ add_fp_unittest(
130130
SRCS
131131
tanf16_test.cpp
132132
DEPENDS
133-
libc.src.errno.errno
133+
libc.hdr.errno_macros
134134
libc.src.math.tanf16
135135
)
136136

@@ -141,7 +141,7 @@ add_fp_unittest(
141141
SRCS
142142
tanpif_test.cpp
143143
DEPENDS
144-
libc.src.errno.errno
144+
libc.hdr.errno_macros
145145
libc.src.math.tanpif
146146
)
147147

@@ -152,7 +152,7 @@ add_fp_unittest(
152152
SRCS
153153
tanpif16_test.cpp
154154
DEPENDS
155-
libc.src.errno.errno
155+
libc.hdr.errno_macros
156156
libc.src.math.tanpif16
157157
)
158158

@@ -4590,6 +4590,7 @@ add_fp_unittest(
45904590
SRCS
45914591
tanhf_test.cpp
45924592
DEPENDS
4593+
libc.hdr.errno_macros
45934594
libc.src.math.tanhf
45944595
libc.src.__support.FPUtil.fp_bits
45954596
)
@@ -4601,8 +4602,8 @@ add_fp_unittest(
46014602
SRCS
46024603
tanhf16_test.cpp
46034604
DEPENDS
4605+
libc.hdr.errno_macros
46044606
libc.hdr.fenv_macros
4605-
libc.src.errno.errno
46064607
libc.src.math.tanhf16
46074608
libc.src.__support.FPUtil.cast
46084609
)

libc/test/src/math/smoke/tanf16_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "src/__support/libc_errno.h"
10+
#include "hdr/errno_macros.h"
1111
#include "src/math/tanf16.h"
1212
#include "test/UnitTest/FPMatcher.h"
1313
#include "test/UnitTest/Test.h"
1414

1515
using LlvmLibcTanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
1616

1717
TEST_F(LlvmLibcTanf16Test, SpecialNumbers) {
18-
libc_errno = 0;
19-
2018
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanf16(sNaN), FE_INVALID);
2119
EXPECT_MATH_ERRNO(0);
2220

libc/test/src/math/smoke/tanf_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "hdr/errno_macros.h"
910
#include "hdr/math_macros.h"
1011
#include "hdr/stdint_proxy.h"
1112
#include "src/__support/FPUtil/FPBits.h"
12-
#include "src/__support/libc_errno.h"
1313
#include "src/math/tanf.h"
1414
#include "test/UnitTest/FPMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

1717
using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
1818

1919
TEST_F(LlvmLibcTanfTest, SpecialNumbers) {
20-
libc_errno = 0;
21-
2220
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanf(sNaN), FE_INVALID);
2321
EXPECT_MATH_ERRNO(0);
2422

libc/test/src/math/smoke/tanhf16_test.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "hdr/errno_macros.h"
910
#include "hdr/fenv_macros.h"
1011
#include "src/__support/FPUtil/cast.h"
11-
#include "src/__support/libc_errno.h"
1212
#include "src/math/tanhf16.h"
1313
#include "test/UnitTest/FPMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

1616
using LlvmLibcTanhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
1717

1818
TEST_F(LlvmLibcTanhf16Test, SpecialNumbers) {
19-
libc_errno = 0;
20-
2119
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::tanhf16(aNaN));
2220
EXPECT_MATH_ERRNO(0);
2321

@@ -40,8 +38,6 @@ TEST_F(LlvmLibcTanhf16Test, SpecialNumbers) {
4038
}
4139

4240
TEST_F(LlvmLibcTanhf16Test, ResultNearBounds) {
43-
libc_errno = 0;
44-
4541
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(1.0),
4642
LIBC_NAMESPACE::tanhf16(max_normal), FE_INEXACT);
4743
EXPECT_MATH_ERRNO(0);

libc/test/src/math/smoke/tanhf_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "hdr/errno_macros.h"
910
#include "hdr/math_macros.h"
1011
#include "hdr/stdint_proxy.h"
1112
#include "src/__support/FPUtil/FPBits.h"
12-
#include "src/__support/libc_errno.h"
1313
#include "src/math/tanhf.h"
1414
#include "test/UnitTest/FPMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

1717
using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
1818

1919
TEST_F(LlvmLibcTanhfTest, SpecialNumbers) {
20-
libc_errno = 0;
21-
2220
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanhf(sNaN), FE_INVALID);
2321
EXPECT_MATH_ERRNO(0);
2422

libc/test/src/math/smoke/tanpif16_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/__support/libc_errno.h"
9+
#include "hdr/errno_macros.h"
1010
#include "src/math/tanpif16.h"
1111
#include "test/UnitTest/FPMatcher.h"
1212
#include "test/UnitTest/Test.h"
1313

1414
using LlvmLibcTanpif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
1515

1616
TEST_F(LlvmLibcTanpif16Test, SpecialNumbers) {
17-
libc_errno = 0;
18-
1917
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanpif16(sNaN), FE_INVALID);
2018
EXPECT_MATH_ERRNO(0);
2119

libc/test/src/math/smoke/tanpif_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/__support/libc_errno.h"
9+
#include "hdr/errno_macros.h"
1010
#include "src/math/tanpif.h"
1111
#include "test/UnitTest/FPMatcher.h"
1212
#include "test/UnitTest/Test.h"
1313

1414
using LlvmLibcTanpifTest = LIBC_NAMESPACE::testing::FPTest<float>;
1515

1616
TEST_F(LlvmLibcTanpifTest, SpecialNumbers) {
17-
libc_errno = 0;
18-
1917
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanpif(sNaN), FE_INVALID);
2018
EXPECT_MATH_ERRNO(0);
2119

0 commit comments

Comments
 (0)