diff options
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r-- | compiler/optimizing/optimizing_unit_test.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index 01571267e2..eb262bc123 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -180,7 +180,29 @@ class OptimizingUnitTestHelper { } } + // Run GraphChecker with all checks. + // + // Return: the status whether the run is successful. + bool CheckGraph(HGraph* graph) { + return CheckGraph(graph, /*check_ref_type_info=*/true); + } + + // Run GraphChecker with all checks except reference type information checks. + // + // Return: the status whether the run is successful. + bool CheckGraphSkipRefTypeInfoChecks(HGraph* graph) { + return CheckGraph(graph, /*check_ref_type_info=*/false); + } + private: + bool CheckGraph(HGraph* graph, bool check_ref_type_info) { + GraphChecker checker(graph); + checker.SetRefTypeInfoCheckEnabled(check_ref_type_info); + checker.Run(); + checker.Dump(std::cerr); + return checker.IsValid(); + } + std::vector<std::unique_ptr<const StandardDexFile>> dex_files_; std::unique_ptr<ArenaPoolAndAllocator> pool_and_allocator_; std::unique_ptr<VariableSizedHandleScope> handles_; @@ -223,15 +245,11 @@ class ImprovedOptimizingUnitTest : public OptimizingUnitTest { } bool CheckGraph() { - GraphChecker checker(graph_); - checker.Run(); - if (!checker.IsValid()) { - for (const std::string& error : checker.GetErrors()) { - std::cout << error << std::endl; - } - return false; - } - return true; + return OptimizingUnitTestHelper::CheckGraph(graph_); + } + + bool CheckGraphSkipRefTypeInfoChecks() { + return OptimizingUnitTestHelper::CheckGraphSkipRefTypeInfoChecks(graph_); } HEnvironment* ManuallyBuildEnvFor(HInstruction* instruction, |