[llvm] fa56e36 - [support] Temporarily disable Inf/NaN testing in PrintNumber

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 11:32:16 PDT 2023


Author: Paul Kirth
Date: 2023-03-24T18:32:06Z
New Revision: fa56e362af475e0758cfb41c42f78db50da7235c

URL: https://github.com/llvm/llvm-project/commit/fa56e362af475e0758cfb41c42f78db50da7235c
DIFF: https://github.com/llvm/llvm-project/commit/fa56e362af475e0758cfb41c42f78db50da7235c.diff

LOG: [support] Temporarily disable Inf/NaN testing in PrintNumber

This is still breaking on some platforms. The underlying implementation
doesn't seem to be the cause, rather the test is not robust across
platforms. So, we'll just disable this for the time being, to unblock
builds until we have a proper fix.

Reviewed By: abhina.sreeskantharajan

Differential Revision: https://reviews.llvm.org/D146834

Added: 
    

Modified: 
    llvm/unittests/Support/ScopedPrinterTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/ScopedPrinterTest.cpp b/llvm/unittests/Support/ScopedPrinterTest.cpp
index dde43cb103ae..48600cd05750 100644
--- a/llvm/unittests/Support/ScopedPrinterTest.cpp
+++ b/llvm/unittests/Support/ScopedPrinterTest.cpp
@@ -567,17 +567,20 @@ TEST_F(ScopedPrinterTest, PrintNumber) {
 
     W.printNumber("float-max", MaxFloat);
     W.printNumber("float-min", MinFloat);
-    W.printNumber("float-inf", InfFloat);
-    W.printNumber("float-nan", NaNFloat);
     W.printNumber("float-42.0", 42.0f);
     W.printNumber("float-42.5625", 42.5625f);
 
     W.printNumber("double-max", MaxDouble);
     W.printNumber("double-min", MinDouble);
-    W.printNumber("double-inf", InfDouble);
-    W.printNumber("double-nan", NaNDouble);
     W.printNumber("double-42.0", 42.0);
     W.printNumber("double-42.5625", 42.5625);
+
+    // FIXME: temporarily disable checking the for Inf and NaN until we have a
+    // cross platform solution can handle this case
+    // W.printNumber("float-inf", InfFloat);
+    // W.printNumber("float-nan", NaNFloat);
+    // W.printNumber("double-inf", InfDouble);
+    // W.printNumber("double-nan", NaNDouble);
   };
 
   // Make sure when we check floating point representation we avoid
@@ -598,30 +601,8 @@ TEST_F(ScopedPrinterTest, PrintNumber) {
   format("%5.1f", MaxDouble).snprint(Buf, sizeof(Buf));
   std::string MaxDoubleStr(Buf);
 
-  format("%5.1f", InfFloat).snprint(Buf, sizeof(Buf));
-  std::string InfFloatStr(Buf);
-
-  format("%5.1f", InfDouble).snprint(Buf, sizeof(Buf));
-  std::string InfDoubleStr(Buf);
-
-  format("%5.1f", NaNFloat).snprint(Buf, sizeof(Buf));
-  std::string NaNFloatStr(Buf);
-
-  format("%5.1f", NaNDouble).snprint(Buf, sizeof(Buf));
-  std::string NaNDoubleStr(Buf);
-
-  format("%.*g", InfFloat).snprint(Buf, sizeof(Buf));
-  std::string JsonInfFloatStr(Buf);
-
-  format("%.*g", InfDouble).snprint(Buf, sizeof(Buf));
-  std::string JsonInfDoubleStr(Buf);
-
-  format("%.*g", NaNFloat).snprint(Buf, sizeof(Buf));
-  std::string JsonNaNFloatStr(Buf);
-
-  format("%.*g", NaNDouble).snprint(Buf, sizeof(Buf));
-  std::string JsonNaNDoubleStr(Buf);
-
+  // FIXME: temporarily disable checking the for Inf and NaN until we have a
+  // cross platform solution can handle this case
 
   std::string ExpectedOut = Twine(
                                 R"(uint64_t-max: 18446744073709551615
@@ -644,15 +625,11 @@ apsint: 9999999999999999999999
 label: value (0)
 float-max: )" + MaxFloatStr + R"(
 float-min:   0.0
-float-inf: )" + InfFloatStr + R"(
-float-nan: )" + NaNFloatStr + R"(
 float-42.0:  42.0
 float-42.5625:  42.6
 double-max: )" + MaxDoubleStr +
                                 R"(
 double-min:   0.0
-double-inf: )" + InfDoubleStr + R"(
-double-nan: )" + NaNDoubleStr + R"(
 double-42.0:  42.0
 double-42.5625:  42.6
 )")
@@ -682,17 +659,14 @@ double-42.5625:  42.6
   },
   "float-max": 3.4028234663852886e+38,
   "float-min": 1.1754943508222875e-38,
-  "float-inf": )" + JsonInfFloatStr + R"(,
-  "float-nan": )" + JsonNaNFloatStr + R"(,
   "float-42.0": 42,
   "float-42.5625": 42.5625,
   "double-max": 1.7976931348623157e+308,
   "double-min": 2.2250738585072014e-308,
-  "double-inf": )" + JsonInfDoubleStr + R"(,
-  "double-nan": )" + JsonNaNDoubleStr + R"(,
   "double-42.0": 42,
   "double-42.5625": 42.5625
-})").str();
+})")
+                                    .str();
   verifyAll(ExpectedOut, JSONExpectedOut, PrintFunc);
 }
 


        


More information about the llvm-commits mailing list