From 4bd7e2a0a9e86b3a00d6c860d1f8eba8aedab062 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 14 Sep 2021 16:58:40 +0200 Subject: [PATCH] Rerun SolidityEndToEndTest.cpp tests on stack errors. --- test/libsolidity/SolidityEndToEndTest.cpp | 51 +++++++++++++++-------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index e724f9998..cfb40d5bc 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -35,6 +35,8 @@ #include #include +#include + #include #include @@ -51,24 +53,37 @@ using namespace solidity::util; using namespace solidity::test; using namespace solidity::langutil; -#define ALSO_VIA_YUL(CODE) \ -{ \ - m_doEwasmTestrun = true; \ - \ - m_compileViaYul = false; \ - m_compileToEwasm = false; \ - { CODE } \ - \ - m_compileViaYul = true; \ - reset(); \ - { CODE } \ - \ - if (m_doEwasmTestrun) \ - { \ - m_compileToEwasm = true; \ - reset(); \ - { CODE } \ - } \ +#define RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ +{ \ + try { CODE } \ + catch (yul::StackTooDeepError const&) \ + { \ + if (m_optimiserSettings == OptimiserSettings::full()) \ + throw; \ + reset(); \ + m_optimiserSettings = OptimiserSettings::full(); \ + { CODE } \ + } \ +} + +#define ALSO_VIA_YUL(CODE) \ +{ \ + m_doEwasmTestrun = true; \ + \ + m_compileViaYul = false; \ + m_compileToEwasm = false; \ + RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ + \ + m_compileViaYul = true; \ + reset(); \ + RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ + \ + if (m_doEwasmTestrun) \ + { \ + m_compileToEwasm = true; \ + reset(); \ + RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ + } \ } #define DISABLE_EWASM_TESTRUN() \