mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 09:46:53 +00:00
fix start function loop
This commit is contained in:
@@ -850,6 +850,38 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
runFinishFunction(localVariableBombHex).has_value() == false);
|
||||
}
|
||||
|
||||
void
|
||||
testStartFunctionLoop()
|
||||
{
|
||||
testcase("infinite loop in start function");
|
||||
|
||||
using namespace test::jtx;
|
||||
Env env(*this);
|
||||
|
||||
auto wasmStr = boost::algorithm::unhex(startLoopHex);
|
||||
Bytes wasm(wasmStr.begin(), wasmStr.end());
|
||||
TestLedgerDataProvider ledgerDataProvider(env);
|
||||
ImportVec imports;
|
||||
|
||||
auto& engine = WasmEngine::instance();
|
||||
auto checkRes = engine.check(
|
||||
wasm, "finish", {}, imports, &ledgerDataProvider, env.journal);
|
||||
BEAST_EXPECTS(
|
||||
checkRes == tesSUCCESS, std::to_string(TERtoInt(checkRes)));
|
||||
|
||||
auto re = engine.run(
|
||||
wasm,
|
||||
ESCROW_FUNCTION_NAME,
|
||||
{},
|
||||
imports,
|
||||
&ledgerDataProvider,
|
||||
1'000'000,
|
||||
env.journal);
|
||||
BEAST_EXPECTS(
|
||||
re.error() == tecFAILED_PROCESSING,
|
||||
std::to_string(TERtoInt(re.error())));
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -878,6 +910,7 @@ struct Wasm_test : public beast::unit_test::suite
|
||||
testWasmWasi();
|
||||
testWasmSectionCorruption();
|
||||
|
||||
testStartFunctionLoop();
|
||||
// perfTest();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user