Skip to content

Commit c8a0714

Browse files
committed
Reduce libc_errno usage in atan and cos smoke tests.
1 parent 49f1751 commit c8a0714

File tree

13 files changed

+16
-45
lines changed

13 files changed

+16
-45
lines changed

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ add_fp_unittest(
88
SRCS
99
cosf_test.cpp
1010
DEPENDS
11-
libc.src.errno.errno
11+
libc.hdr.errno_macros
1212
libc.src.math.cosf
1313
)
1414

@@ -19,7 +19,7 @@ add_fp_unittest(
1919
SRCS
2020
cosf16_test.cpp
2121
DEPENDS
22-
libc.src.errno.errno
22+
libc.hdr.errno_macros
2323
libc.src.math.cosf16
2424
)
2525

@@ -30,7 +30,7 @@ add_fp_unittest(
3030
SRCS
3131
cospif_test.cpp
3232
DEPENDS
33-
libc.src.errno.errno
33+
libc.hdr.errno_macros
3434
libc.src.math.cospif
3535
libc.src.__support.CPP.array
3636
libc.src.__support.FPUtil.fp_bits
@@ -43,7 +43,7 @@ add_fp_unittest(
4343
SRCS
4444
cospif16_test.cpp
4545
DEPENDS
46-
libc.src.errno.errno
46+
libc.hdr.errno_macros
4747
libc.src.math.cospif16
4848
libc.src.__support.FPUtil.cast
4949
)
@@ -4540,7 +4540,7 @@ add_fp_unittest(
45404540
SRCS
45414541
coshf_test.cpp
45424542
DEPENDS
4543-
libc.src.errno.errno
4543+
libc.hdr.errno_macros
45444544
libc.src.math.coshf
45454545
libc.src.__support.CPP.array
45464546
libc.src.__support.FPUtil.fp_bits
@@ -4553,8 +4553,8 @@ add_fp_unittest(
45534553
SRCS
45544554
coshf16_test.cpp
45554555
DEPENDS
4556+
libc.hdr.errno_macros
45564557
libc.hdr.fenv_macros
4557-
libc.src.errno.errno
45584558
libc.src.math.coshf16
45594559
libc.src.__support.FPUtil.cast
45604560
)
@@ -4616,7 +4616,7 @@ add_fp_unittest(
46164616
SRCS
46174617
atanhf_test.cpp
46184618
DEPENDS
4619-
libc.src.errno.errno
4619+
libc.hdr.errno_macros
46204620
libc.src.math.atanhf
46214621
libc.src.__support.FPUtil.fp_bits
46224622
)
@@ -4628,7 +4628,7 @@ add_fp_unittest(
46284628
SRCS
46294629
atanhf16_test.cpp
46304630
DEPENDS
4631-
libc.src.errno.errno
4631+
libc.hdr.errno_macros
46324632
libc.src.math.atanhf16
46334633
libc.src.__support.FPUtil.cast
46344634
)
@@ -4642,7 +4642,6 @@ add_fp_unittest(
46424642
atanpif16_test.cpp
46434643
DEPENDS
46444644
libc.src.math.atanpif16
4645-
libc.src.errno.errno
46464645
)
46474646

46484647
add_fp_unittest(
@@ -4790,7 +4789,6 @@ add_fp_unittest(
47904789
SRCS
47914790
atanf_test.cpp
47924791
DEPENDS
4793-
libc.src.errno.errno
47944792
libc.src.math.atanf
47954793
libc.src.__support.FPUtil.fp_bits
47964794
)
@@ -4812,7 +4810,6 @@ add_fp_unittest(
48124810
SRCS
48134811
atanf16_test.cpp
48144812
DEPENDS
4815-
libc.src.errno.errno
48164813
libc.src.math.atanf16
48174814
)
48184815

@@ -4823,7 +4820,6 @@ add_fp_unittest(
48234820
SRCS
48244821
atan2f_test.cpp
48254822
DEPENDS
4826-
libc.src.errno.errno
48274823
libc.src.math.atan2f
48284824
libc.src.__support.FPUtil.fp_bits
48294825
)

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88

99
#include "hdr/math_macros.h"
1010
#include "src/__support/FPUtil/FPBits.h"
11-
#include "src/__support/libc_errno.h"
1211
#include "src/math/atan2f.h"
1312
#include "test/UnitTest/FPMatcher.h"
1413
#include "test/UnitTest/Test.h"
1514

1615
using LlvmLibcAtan2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
1716

1817
TEST_F(LlvmLibcAtan2fTest, SpecialNumbers) {
19-
libc_errno = 0;
20-
2118
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atan2f(sNaN, sNaN),
2219
FE_INVALID);
2320
EXPECT_MATH_ERRNO(0);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/__support/libc_errno.h"
109
#include "src/math/atanf16.h"
1110
#include "test/UnitTest/FPMatcher.h"
1211
#include "test/UnitTest/Test.h"
1312

1413
using LlvmLibcAtanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
1514

1615
TEST_F(LlvmLibcAtanf16Test, SpecialNumbers) {
17-
libc_errno = 0;
1816
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::atanf16(aNaN));
1917
EXPECT_MATH_ERRNO(0);
2018

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "hdr/math_macros.h"
1010
#include "src/__support/FPUtil/FPBits.h"
11-
#include "src/__support/libc_errno.h"
1211
#include "src/math/atanf.h"
1312
#include "test/UnitTest/FPMatcher.h"
1413
#include "test/UnitTest/Test.h"
@@ -18,7 +17,6 @@
1817
using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
1918

2019
TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
21-
libc_errno = 0;
2220
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanf(sNaN), FE_INVALID);
2321
EXPECT_MATH_ERRNO(0);
2422

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

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

9+
#include "hdr/errno_macros.h"
910
#include "src/__support/FPUtil/cast.h"
10-
#include "src/__support/libc_errno.h"
1111
#include "src/math/atanhf16.h"
1212
#include "test/UnitTest/FPMatcher.h"
1313
#include "test/UnitTest/Test.h"
1414

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

1717
TEST_F(LlvmLibcAtanhf16Test, SpecialNumbers) {
18-
libc_errno = 0;
1918
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf16(sNaN),
2019
FE_INVALID);
2120
EXPECT_MATH_ERRNO(0);

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

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

9+
#include "hdr/errno_macros.h"
910
#include "hdr/math_macros.h"
1011
#include "src/__support/FPUtil/FPBits.h"
11-
#include "src/__support/libc_errno.h"
1212
#include "src/math/atanhf.h"
1313
#include "test/UnitTest/FPMatcher.h"
1414
#include "test/UnitTest/Test.h"
@@ -20,7 +20,6 @@ using LIBC_NAMESPACE::Sign;
2020
using LlvmLibcAtanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
2121

2222
TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
23-
libc_errno = 0;
2423
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanhf(sNaN), FE_INVALID);
2524
EXPECT_MATH_ERRNO(0);
2625
// TODO: Strengthen errno,exception checks and remove these assert macros

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/__support/libc_errno.h"
109
#include "src/math/atanpif16.h"
1110
#include "test/UnitTest/FPMatcher.h"
1211

libc/test/src/math/smoke/cosf16_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/cosf16.h"
1111
#include "test/UnitTest/FPMatcher.h"
1212
#include "test/UnitTest/Test.h"
1313

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

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

libc/test/src/math/smoke/cosf_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/cosf.h"
1414
#include "test/UnitTest/FPMatcher.h"
1515
#include "test/UnitTest/Test.h"
1616

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

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

libc/test/src/math/smoke/coshf16_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/coshf16.h"
1313
#include "test/UnitTest/FPMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

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

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

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

4240
TEST_F(LlvmLibcCoshf16Test, Overflow) {
43-
libc_errno = 0;
44-
4541
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::coshf16(max_normal),
4642
FE_OVERFLOW | FE_INEXACT);
4743
EXPECT_MATH_ERRNO(ERANGE);

0 commit comments

Comments
 (0)