[PATCH] D114454: [NFC][AIX]Disable unstable CSA tests failing on AIX

Steven Wan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 30 12:52:08 PST 2021


stevewan updated this revision to Diff 390795.
stevewan added a comment.
Herald added a subscriber: mgorny.

Pin target triple before analysis


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114454/new/

https://reviews.llvm.org/D114454

Files:
  clang/unittests/StaticAnalyzer/CMakeLists.txt
  clang/unittests/StaticAnalyzer/SValTest.cpp


Index: clang/unittests/StaticAnalyzer/SValTest.cpp
===================================================================
--- clang/unittests/StaticAnalyzer/SValTest.cpp
+++ clang/unittests/StaticAnalyzer/SValTest.cpp
@@ -21,6 +21,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
 #include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
+#include "clang/Testing/TestClangConfig.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -91,6 +92,17 @@
   mutable SVals CollectedSVals;
 };
 
+// Fixture class for parameterized SValTest
+class SValTest : public testing::TestWithParam<TestClangConfig> {
+protected:
+  // FIXME: This is a hack to work around the fact that there is no way to
+  // differentiate int and long on 32-bit AIX solely based on bitwidth.
+  bool skipOnPPC32AIX(StringRef TestName) {
+    return GetParam().Target == "powerpc-ibm-aix" &&
+           (TestName == "GetConstType" || TestName == "GetLocAsIntType");
+  }
+};
+
 // SVAL_TEST is a combined way of providing a short code snippet and
 // to test some programmatic predicates on symbolic values produced by the
 // engine for the actual code.
@@ -135,7 +147,12 @@
     });                                                                        \
   }                                                                            \
                                                                                \
-  TEST(SValTest, NAME) { runCheckerOnCode<add##NAME##SValCollector>(CODE); }   \
+  TEST_P(SValTest, NAME) {                                                     \
+    if (skipOnPPC32AIX(#NAME))                                                 \
+      return;                                                                  \
+    runCheckerOnCodeWithArgs<add##NAME##SValCollector>(                        \
+        CODE, GetParam().getCommandLineArgs());                                \
+  }                                                                            \
   void NAME##SValCollector::test(ExprEngine &Engine,                           \
                                  const ASTContext &Context) const
 
@@ -361,6 +378,20 @@
   EXPECT_EQ(Context.VoidPtrTy, B.getType(Context));
 }
 
+std::vector<TestClangConfig> allTestClangConfigs() {
+  std::vector<TestClangConfig> all_configs;
+  TestClangConfig config;
+  config.Language = Lang_CXX14;
+  config.Target = "powerpc-ibm-aix";
+  all_configs.push_back(config);
+  config.Target = "powerpc-ibm-linux";
+  all_configs.push_back(config);
+  return all_configs;
+}
+
+INSTANTIATE_TEST_SUITE_P(SValTests, SValTest,
+                         testing::ValuesIn(allTestClangConfigs()));
+
 } // namespace
 } // namespace ento
 } // namespace clang
Index: clang/unittests/StaticAnalyzer/CMakeLists.txt
===================================================================
--- clang/unittests/StaticAnalyzer/CMakeLists.txt
+++ clang/unittests/StaticAnalyzer/CMakeLists.txt
@@ -31,5 +31,6 @@
   clangSerialization
   clangStaticAnalyzerCore
   clangStaticAnalyzerFrontend
+  clangTesting
   clangTooling
   )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114454.390795.patch
Type: text/x-patch
Size: 3191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211130/c330733f/attachment-0001.bin>


More information about the cfe-commits mailing list