Skip to content

Commit 8c7eccd

Browse files
authored
Merge pull request #435 from secure-software-engineering/f-SkipGTEST_SKIPForLLVMintree
Disable tests that use GTEST_SKIP for IN_TREE builds.
2 parents 9e486e0 + 357f589 commit 8c7eccd

6 files changed

Lines changed: 42 additions & 32 deletions

File tree

unittests/PhasarLLVM/ControlFlow/LLVMBasedCFGTest.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,10 @@ TEST(LLVMBasedCFGTest, HandleFieldStoreField) {
235235
ASSERT_TRUE(Cfg.isFieldStore(Inst));
236236
}
237237

238-
TEST(LLVMBasedCFGTest, HandlesCppStandardType) {
239-
// If we use libcxx this won't work since internal implementation is different
240-
#ifdef _LIBCPP_VERSION
241-
GTEST_SKIP();
242-
#endif
238+
PHASAR_SKIP_TEST(TEST(LLVMBasedCFGTest, HandlesCppStandardType) {
239+
// If we use libcxx this won't work since internal implementation is different
240+
LIBCPP_GTEST_SKIP();
241+
243242
ProjectIRDB IRDB(
244243
{unittest::PathToLLTestFiles + "name_mangling/special_members_2_cpp.ll"});
245244

@@ -256,7 +255,7 @@ TEST(LLVMBasedCFGTest, HandlesCppStandardType) {
256255
"_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev");
257256
ASSERT_EQ(CFG.getSpecialMemberFunctionType(O),
258257
SpecialMemberFunctionType::Destructor);
259-
}
258+
})
260259

261260
TEST(LLVMBasedCFGTest, HandlesCppUserDefinedType) {
262261
ProjectIRDB IRDB(

unittests/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEExtendedTaintAnalysisTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ TEST_F(IDETaintAnalysisTest, XTaint18) {
310310
doAnalysis({PathToLLFiles + "xtaint18_cpp.ll"}, gt, std::monostate{});
311311
}
312312

313-
TEST_F(IDETaintAnalysisTest, XTaint19) {
313+
PHASAR_SKIP_TEST(TEST_F(IDETaintAnalysisTest, XTaint19) {
314314
// Is now the same as XTaint17
315315
GTEST_SKIP();
316316
map<int, set<string>> gt;
317317

318318
gt[22] = {"21"};
319319

320320
doAnalysis({PathToLLFiles + "xtaint19_cpp.ll"}, gt, std::monostate{});
321-
}
321+
})
322322

323323
TEST_F(IDETaintAnalysisTest, XTaint20) {
324324
map<int, set<string>> gt;

unittests/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEInstInteractionAnalysisTest.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,10 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleBasicTest_03) {
246246
doAnalysisAndCompareResults("basic_03_cpp.ll", GroundTruth, false);
247247
}
248248

249-
TEST_F(IDEInstInteractionAnalysisTest, HandleBasicTest_04) {
250-
// If we use libcxx this won't work since internal implementation is different
251-
#ifdef _LIBCPP_VERSION
252-
GTEST_SKIP();
253-
#endif
249+
PHASAR_SKIP_TEST(TEST_F(IDEInstInteractionAnalysisTest, HandleBasicTest_04) {
250+
// If we use libcxx this won't work since internal implementation is different
251+
LIBCPP_GTEST_SKIP();
252+
254253
std::set<IIACompactResult_t> GroundTruth;
255254
GroundTruth.emplace(
256255
std::tuple<std::string, size_t, std::string, BitVectorSet<std::string>>(
@@ -271,7 +270,7 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleBasicTest_04) {
271270
std::tuple<std::string, size_t, std::string, BitVectorSet<std::string>>(
272271
"main", 24, "k", {"10", "11", "12", "16", "19", "20", "25", "27"}));
273272
doAnalysisAndCompareResults("basic_04_cpp.ll", GroundTruth, false);
274-
}
273+
})
275274

276275
TEST_F(IDEInstInteractionAnalysisTest, HandleBasicTest_05) {
277276
std::set<IIACompactResult_t> GroundTruth;
@@ -547,11 +546,10 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleHeapTest_01) {
547546
doAnalysisAndCompareResults("heap_01_cpp.ll", GroundTruth, false);
548547
}
549548

550-
TEST_F(IDEInstInteractionAnalysisTest, HandleRVOTest_01) {
551-
// If we use libcxx this won't work since internal implementation is different
552-
#ifdef _LIBCPP_VERSION
553-
GTEST_SKIP();
554-
#endif
549+
PHASAR_SKIP_TEST(TEST_F(IDEInstInteractionAnalysisTest, HandleRVOTest_01) {
550+
// If we use libcxx this won't work since internal implementation is different
551+
LIBCPP_GTEST_SKIP();
552+
555553
std::set<IIACompactResult_t> GroundTruth;
556554
GroundTruth.emplace(
557555
std::tuple<std::string, size_t, std::string, BitVectorSet<std::string>>(
@@ -563,7 +561,7 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleRVOTest_01) {
563561
std::tuple<std::string, size_t, std::string, BitVectorSet<std::string>>(
564562
"main", 16, "ref.tmp", {"25", "5", "8", "31", "32", "30"}));
565563
doAnalysisAndCompareResults("rvo_01_cpp.ll", GroundTruth, false);
566-
}
564+
})
567565

568566
// // TEST_F(IDEInstInteractionAnalysisTest, HandleStruct_01) {
569567
// // std::set<IIACompactResult_t> GroundTruth;

unittests/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IFDSConstAnalysisTest.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,16 +366,15 @@ TEST_F(IFDSConstAnalysisTest, HandleSTLArrayTest_02) {
366366
compareResults({0, 1}, Llvmconstsolver);
367367
}
368368

369-
TEST_F(IFDSConstAnalysisTest, HandleSTLArrayTest_03) {
370-
// If we use libcxx this won't work since internal implementation is different
371-
#ifdef _LIBCPP_VERSION
372-
GTEST_SKIP();
373-
#endif
369+
PHASAR_SKIP_TEST(TEST_F(IFDSConstAnalysisTest, HandleSTLArrayTest_03) {
370+
// If we use libcxx this won't work since internal implementation is different
371+
LIBCPP_GTEST_SKIP();
372+
374373
initialize({PathToLlFiles + "array/stl_array/stl_array_03_cpp_m2r_dbg.ll"});
375374
IFDSSolver_P<IFDSConstAnalysis> Llvmconstsolver(*Constproblem);
376375
Llvmconstsolver.solve();
377376
compareResults({0, 1, 2}, Llvmconstsolver);
378-
}
377+
})
379378

380379
TEST_F(IFDSConstAnalysisTest, DISABLED_HandleSTLArrayTest_04) {
381380
// Guaranteed to fail - enable, once we have more precise points-to

unittests/PhasarLLVM/TypeHierarchy/LLVMTypeHierarchyTest.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,10 @@ TEST(LTHTest, TransitivelyReachableTypes) {
730730
// // }
731731

732732
// Failing test case
733-
TEST(LTHTest, HandleSTLString) {
734-
// If we use libcxx this won't work since internal implementation is different
735-
#ifdef _LIBCPP_VERSION
736-
GTEST_SKIP();
737-
#endif
733+
PHASAR_SKIP_TEST(TEST(LTHTest, HandleSTLString) {
734+
// If we use libcxx this won't work since internal implementation is different
735+
LIBCPP_GTEST_SKIP();
736+
738737
ProjectIRDB IRDB({unittest::PathToLLTestFiles +
739738
"type_hierarchies/type_hierarchy_13_cpp.ll"});
740739
LLVMTypeHierarchy TH(IRDB);
@@ -759,7 +758,7 @@ TEST(LTHTest, HandleSTLString) {
759758
"std::allocator<char> >::_Alloc_hider")));
760759
EXPECT_TRUE(TH.isSuperType(TH.getType("class.std::allocator"),
761760
TH.getType("class.std::allocator")));
762-
}
761+
})
763762

764763
} // namespace psr
765764

unittests/TestUtils/TestConfig.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ inline const std::string PathToTxtTestFiles(PhasarConfig::PhasarDirectory() +
1616
inline const std::string PathToJSONTestFiles(PhasarConfig::PhasarDirectory() +
1717
"test/json_test_code/");
1818

19+
// Remove wrapped tests in case GTEST_SKIP is not available. This is needed as
20+
// LLVM currently ships with an older version of gtest (<1.10.0) that does not
21+
// support GTEST_SKIP. TODO: Remove this macro after LLVM updated their gtest.
22+
#ifdef GTEST_SKIP
23+
#define PHASAR_SKIP_TEST(...) __VA_ARGS__
24+
#else
25+
#define PHASAR_SKIP_TEST(...)
26+
#endif
27+
28+
#ifdef _LIBCPP_VERSION
29+
#define LIBCPP_GTEST_SKIP GTEST_SKIP
30+
#else
31+
#define LIBCPP_GTEST_SKIP
32+
#endif
33+
1934
} // namespace psr::unittest
2035

2136
#endif // UNITTEST_TESTUTILS_TESTCONFIG_H_

0 commit comments

Comments
 (0)