@@ -138,7 +138,7 @@ class IDEInstInteractionAnalysisTest : public ::testing::Test {
138138 << llvmIRToString (IRLine) << " '." ;
139139 }
140140
141- if (HasFailure ()) {
141+ if (PrintDump || HasFailure ()) {
142142 IIASolver.dumpResults (llvm::errs ());
143143 llvm::errs ()
144144 << " \n ======================================================\n " ;
@@ -342,8 +342,9 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleCallTest_03) {
342342 GroundTruth.emplace (" main" , 10 , " retval" , std::set<std::string>{" 20" });
343343 GroundTruth.emplace (" main" , 10 , " i" , std::set<std::string>{" 21" });
344344 GroundTruth.emplace (" main" , 10 , " j" ,
345- std::set<std::string>{" 22" , " 15" , " 6" , " 21" , " 2" , " 13" ,
346- " 8" , " 9" , " 12" , " 10" , " 24" });
345+ std::set<std::string>{" 22" , " 23" , " 15" , " 6" , " 21" , " 2" ,
346+ " 13" , " 8" , " 9" , " 11" , " 12" , " 10" ,
347+ " 24" });
347348 doAnalysisAndCompareResults (" call_03_cpp.ll" , {" main" }, GroundTruth, false );
348349}
349350
@@ -353,12 +354,14 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleCallTest_04) {
353354 GroundTruth.emplace (" main" , 20 , " i" , std::set<std::string>{" 34" });
354355 GroundTruth.emplace (" main" , 20 , " j" ,
355356 std::set<std::string>{" 15" , " 6" , " 2" , " 13" , " 8" , " 9" ,
356- " 12" , " 10" , " 35" , " 34" , " 37" });
357+ " 11" , " 12" , " 10" , " 35" , " 36" , " 34" ,
358+ " 37" });
357359 GroundTruth.emplace (" main" , 20 , " k" ,
358- std::set<std::string>{
359- " 41" , " 19" , " 15" , " 6" , " 44" , " 2" , " 13" , " 8" , " 45" ,
360- " 18" , " 9" , " 12" , " 10" , " 46" , " 24" , " 25" , " 35" , " 27" ,
361- " 23" , " 26" , " 38" , " 34" , " 37" , " 42" , " 40" });
360+ std::set<std::string>{" 41" , " 19" , " 15" , " 6" , " 44" , " 2" ,
361+ " 13" , " 8" , " 45" , " 18" , " 9" , " 11" ,
362+ " 12" , " 10" , " 46" , " 24" , " 25" , " 35" ,
363+ " 36" , " 27" , " 23" , " 26" , " 38" , " 34" ,
364+ " 37" , " 42" , " 43" , " 39" , " 40" });
362365 doAnalysisAndCompareResults (" call_04_cpp.ll" , {" main" }, GroundTruth, false );
363366}
364367
@@ -374,14 +377,18 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleCallTest_06) {
374377 // NOTE: Here we are suffering from IntraProceduralAliasesOnly
375378 std::set<IIACompactResult_t> GroundTruth;
376379 GroundTruth.emplace (" main" , 24 , " retval" , std::set<std::string>{" 11" });
377- GroundTruth.emplace (" main" , 24 , " i" ,
378- std::set<std::string>{" 3" , " 1" , " 2" , " 16" , " 18" , " 12" });
379- GroundTruth.emplace (" main" , 24 , " j" ,
380- std::set<std::string>{" 19" , " 21" , " 3" , " 1" , " 2" , " 13" });
381- GroundTruth.emplace (" main" , 24 , " k" ,
382- std::set<std::string>{" 22" , " 3" , " 14" , " 1" , " 2" , " 24" });
383- GroundTruth.emplace (" main" , 24 , " l" ,
384- std::set<std::string>{" 15" , " 3" , " 1" , " 2" , " 25" , " 27" });
380+ GroundTruth.emplace (
381+ " main" , 24 , " i" ,
382+ std::set<std::string>{" 3" , " 1" , " 2" , " 16" , " 17" , " 18" , " 12" });
383+ GroundTruth.emplace (
384+ " main" , 24 , " j" ,
385+ std::set<std::string>{" 19" , " 20" , " 21" , " 3" , " 1" , " 2" , " 13" });
386+ GroundTruth.emplace (
387+ " main" , 24 , " k" ,
388+ std::set<std::string>{" 22" , " 23" , " 3" , " 14" , " 1" , " 2" , " 24" });
389+ GroundTruth.emplace (
390+ " main" , 24 , " l" ,
391+ std::set<std::string>{" 15" , " 3" , " 1" , " 2" , " 25" , " 26" , " 27" });
385392 doAnalysisAndCompareResults (" call_06_cpp.ll" , {" main" }, GroundTruth, false );
386393}
387394
@@ -433,17 +440,16 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleGlobalTest_04) {
433440}
434441TEST_F (IDEInstInteractionAnalysisTest, HandleGlobalTest_05) {
435442 std::set<IIACompactResult_t> GroundTruth;
436- // GroundTruth.emplace("main", 1, "GlobalFeature",
437- // std::set<std::string>{"0"}); GroundTruth.emplace("main", 2,
438- // "GlobalFeature", std::set<std::string>{"0"}); GroundTruth.emplace("main",
439- // 17, "GlobalFeature", std::set<std::string>{"0"});
440- // GroundTruth.emplace("_Z7doStuffi", 1, "GlobalFeature",
441- // std::set<std::string>{"0"});
442- // GroundTruth.emplace("_Z7doStuffi", 2, "GlobalFeature",
443- // std::set<std::string>{"0"});
443+
444+ // NOTE: Facts at init() should be empty, except for its own ID;
445+ // g should be strongly updated
446+
447+ GroundTruth.emplace (" main" , 1 , " g" , std::set<std::string>{" 0" });
448+ GroundTruth.emplace (" main" , 2 , " g" , std::set<std::string>{" 2" });
449+ GroundTruth.emplace (" main" , 4 , " call" , std::set<std::string>{" 2" , " 4" , " 7" });
450+ GroundTruth.emplace (" main" , 4 , " g" , std::set<std::string>{" 2" });
451+
444452 doAnalysisAndCompareResults (" global_05_cpp.ll" , {" main" }, GroundTruth, true );
445- ASSERT_FALSE (true ) << " TODO: Add GroundTruth! An init() soll nichts stehen, "
446- " außer init() selbst. g soll strongly updated sein" ;
447453}
448454
449455TEST_F (IDEInstInteractionAnalysisTest, KillTest_01) {
@@ -470,9 +476,10 @@ TEST_F(IDEInstInteractionAnalysisTest, HandleReturnTest_01) {
470476 std::set<IIACompactResult_t> GroundTruth;
471477 GroundTruth.emplace (" main" , 6 , " retval" , std::set<std::string>{" 3" });
472478 GroundTruth.emplace (" main" , 6 , " localVar" , std::set<std::string>{" 4" });
473- GroundTruth.emplace (" main" , 6 , " call" , std::set<std::string>{" 0" });
474- GroundTruth.emplace (" main" , 8 , " localVar" , std::set<std::string>{" 0" , " 6" });
475- GroundTruth.emplace (" main" , 8 , " call" , std::set<std::string>{" 0" });
479+ GroundTruth.emplace (" main" , 6 , " call" , std::set<std::string>{" 0" , " 5" });
480+ GroundTruth.emplace (" main" , 8 , " localVar" ,
481+ std::set<std::string>{" 0" , " 5" , " 6" });
482+ GroundTruth.emplace (" main" , 8 , " call" , std::set<std::string>{" 0" , " 5" });
476483 doAnalysisAndCompareResults (" return_01_cpp.ll" , {" main" }, GroundTruth, false );
477484}
478485
@@ -499,43 +506,44 @@ PHASAR_SKIP_TEST(TEST_F(IDEInstInteractionAnalysisTest, HandleRVOTest_01) {
499506})
500507
501508PHASAR_SKIP_TEST (TEST_F(IDEInstInteractionAnalysisTest, HandleRVOTest_02) {
502- // GTEST_SKIP() << "This test heavily depends on the used stdlib version.
503- // TODO: "
504- // "add a better one";
509+ GTEST_SKIP () << " This test heavily depends on the used stdlib version. TODO: "
510+ " add a better one" ;
505511
506512 std::set<IIACompactResult_t> GroundTruth;
507- // GroundTruth.emplace("main", 16 , "retval", std::set<std::string>{"75",
508- // "76"}); GroundTruth.emplace("main", 16 , "str",
509- // std::set<std::string>{"70", "65", "72", "74", "77"});
510- // GroundTruth.emplace("main", 16 , "ref.tmp",
511- // std::set<std::string>{"66", "9", "72", "73", "71"});
513+ GroundTruth.emplace (" main" , 18 , " retval" , std::set<std::string>{" 75" , " 76 " });
514+ GroundTruth.emplace (" main" , 18 , " str" ,
515+ std::set<std::string>{" 70" , " 65" , " 72" , " 74" , " 77" });
516+ GroundTruth.emplace (" main" , 18 , " ref.tmp" ,
517+ std::set<std::string>{" 66" , " 9" , " 72" , " 73" , " 71" });
512518 doAnalysisAndCompareResults (" rvo_02_cpp.ll" , {" main" }, GroundTruth, true );
513-
514- ASSERT_FALSE (true ) << " Add GroundTruth!" ;
515519})
516520
517521TEST_F (IDEInstInteractionAnalysisTest, HandleRVOTest_03) {
518522 std::set<IIACompactResult_t> GroundTruth;
519- // GroundTruth.emplace("main", 16, "retval", std::set<std::string>{"75",
520- // "76"}); GroundTruth.emplace("main", 16, "str",
521- // std::set<std::string>{"70", "65", "72", "74", "77"});
522- // GroundTruth.emplace("main", 16, "ref.tmp",
523- // std::set<std::string>{"66", "9", "72", "73", "71"});
524- doAnalysisAndCompareResults (" rvo_03_cpp.ll" , {" main" }, GroundTruth, true );
525523
526- ASSERT_FALSE (true ) << " Add GroundTruth!" ;
524+ GroundTruth.emplace (
525+ " main" , 19 , " Str" ,
526+ std::set<std::string>{" 40" , " 44" , " 47" , " 50" , " 52" , " 55" , " 64" });
527+ GroundTruth.emplace (" main" , 19 , " ref.tmp" ,
528+ std::set<std::string>{" 14" , " 2" , " 20" , " 21" , " 24" , " 25" ,
529+ " 26" , " 28" , " 30" , " 33" , " 41" , " 46" ,
530+ " 47" , " 48" });
531+ GroundTruth.emplace (" main" , 19 , " ref.tmp1" ,
532+ std::set<std::string>{" 1" , " 14" , " 20" , " 21" , " 24" , " 25" ,
533+ " 26" , " 28" , " 30" , " 33" , " 49" , " 50" ,
534+ " 51" });
535+ doAnalysisAndCompareResults (" rvo_03_cpp.ll" , {" main" }, GroundTruth, true );
527536}
528537
529538TEST_F (IDEInstInteractionAnalysisTest, HandleRVOTest_04) {
530539 std::set<IIACompactResult_t> GroundTruth;
531- // GroundTruth.emplace("main", 16, "retval", std::set<std::string>{"75",
532- // "76"}); GroundTruth.emplace("main", 16, "str",
533- // std::set<std::string>{"70", "65", "72", "74", "77"});
534- // GroundTruth.emplace("main", 16, "ref.tmp",
535- // std::set<std::string>{"66", "9", "72", "73", "71"});
540+ GroundTruth.emplace (" main" , 12 , " retval" , std::set<std::string>{" 16" });
541+ GroundTruth.emplace (
542+ " main" , 12 , " F" ,
543+ std::set<std::string>{" 11" , " 14" , " 17" , " 18" , " 21" , " 4" , " 5" });
544+ GroundTruth.emplace (" main" , 12 , " ref.tmp" ,
545+ std::set<std::string>{" 11" , " 18" , " 4" , " 5" });
536546 doAnalysisAndCompareResults (" rvo_04_cpp.ll" , {" main" }, GroundTruth, true );
537-
538- ASSERT_FALSE (true ) << " Add GroundTruth!" ;
539547}
540548
541549} // namespace
0 commit comments