mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
refactor: Clean up test logging to make it easier to search (#5396)
This PR replaces the word `failed` with `failure` in any test names and renames some test files to fix MSVC warnings, so that it is easier to search through the test output to find tests that failed.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/AMM.h>
|
||||
#include <test/jtx/AMMTest.h>
|
||||
#include <test/jtx/CaptureLogs.h>
|
||||
#include <test/jtx/amount.h>
|
||||
#include <test/jtx/sendmax.h>
|
||||
|
||||
@@ -6079,6 +6080,8 @@ private:
|
||||
testcase("Fix changeSpotPriceQuality");
|
||||
using namespace jtx;
|
||||
|
||||
std::string logs;
|
||||
|
||||
enum class Status {
|
||||
SucceedShouldSucceedResize, // Succeed in pre-fix because
|
||||
// error allowance, succeed post-fix
|
||||
@@ -6161,7 +6164,7 @@ private:
|
||||
boost::smatch match;
|
||||
// tests that succeed should have the same amounts pre-fix and post-fix
|
||||
std::vector<std::pair<STAmount, STAmount>> successAmounts;
|
||||
Env env(*this, features);
|
||||
Env env(*this, features, std::make_unique<CaptureLogs>(&logs));
|
||||
auto rules = env.current()->rules();
|
||||
CurrentTransactionRulesGuard rg(rules);
|
||||
for (auto const& t : tests)
|
||||
@@ -6355,6 +6358,8 @@ private:
|
||||
using namespace std::chrono;
|
||||
FeatureBitset const all{features};
|
||||
|
||||
std::string logs;
|
||||
|
||||
Account const gatehub{"gatehub"};
|
||||
Account const bitstamp{"bitstamp"};
|
||||
Account const trader{"trader"};
|
||||
@@ -6583,7 +6588,7 @@ private:
|
||||
for (auto const& features :
|
||||
{all - fixAMMOverflowOffer, all | fixAMMOverflowOffer})
|
||||
{
|
||||
Env env(*this, features);
|
||||
Env env(*this, features, std::make_unique<CaptureLogs>(&logs));
|
||||
|
||||
env.fund(XRP(5'000), gatehub, bitstamp, trader);
|
||||
env.close();
|
||||
|
||||
@@ -828,7 +828,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
|
||||
Account const john{"john"};
|
||||
|
||||
{
|
||||
testcase("Payment failed with disabled credentials rule.");
|
||||
testcase("Payment failure with disabled credentials rule.");
|
||||
|
||||
Env env(*this, supported_amendments() - featureCredentials);
|
||||
|
||||
@@ -930,7 +930,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
|
||||
}
|
||||
|
||||
{
|
||||
testcase("Payment failed with invalid credentials.");
|
||||
testcase("Payment failure with invalid credentials.");
|
||||
|
||||
Env env(*this);
|
||||
|
||||
@@ -1206,7 +1206,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
|
||||
Account const zelda{"zelda"};
|
||||
|
||||
{
|
||||
testcase("Payment failed with expired credentials.");
|
||||
testcase("Payment failure with expired credentials.");
|
||||
|
||||
Env env(*this);
|
||||
|
||||
@@ -1353,7 +1353,7 @@ struct DepositPreauth_test : public beast::unit_test::suite
|
||||
{
|
||||
using namespace std::chrono;
|
||||
|
||||
testcase("Escrow failed with expired credentials.");
|
||||
testcase("Escrow failure with expired credentials.");
|
||||
|
||||
Env env(*this);
|
||||
|
||||
|
||||
@@ -210,8 +210,10 @@ public:
|
||||
* @param args collection of features
|
||||
*
|
||||
*/
|
||||
Env(beast::unit_test::suite& suite_, FeatureBitset features)
|
||||
: Env(suite_, envconfig(), features)
|
||||
Env(beast::unit_test::suite& suite_,
|
||||
FeatureBitset features,
|
||||
std::unique_ptr<Logs> logs = nullptr)
|
||||
: Env(suite_, envconfig(), features, std::move(logs))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
void
|
||||
testValid()
|
||||
{
|
||||
testcase("Valid");
|
||||
using namespace jtx;
|
||||
Account const alice{"alice"};
|
||||
Account const becky{"becky"};
|
||||
@@ -162,6 +163,7 @@ public:
|
||||
void
|
||||
testErrors()
|
||||
{
|
||||
testcase("Errors");
|
||||
using namespace jtx;
|
||||
Account const alice{"alice"};
|
||||
Account const becky{"becky"};
|
||||
@@ -333,6 +335,8 @@ public:
|
||||
void
|
||||
testCredentials()
|
||||
{
|
||||
testcase("Credentials");
|
||||
|
||||
using namespace jtx;
|
||||
|
||||
const char credType[] = "abcde";
|
||||
@@ -363,7 +367,7 @@ public:
|
||||
|
||||
{
|
||||
testcase(
|
||||
"deposit_authorized with credentials failed: empty array.");
|
||||
"deposit_authorized with credentials failure: empty array.");
|
||||
|
||||
auto args = depositAuthArgs(alice, becky, "validated");
|
||||
args[jss::credentials] = Json::arrayValue;
|
||||
@@ -376,7 +380,7 @@ public:
|
||||
|
||||
{
|
||||
testcase(
|
||||
"deposit_authorized with credentials failed: not a string "
|
||||
"deposit_authorized with credentials failure: not a string "
|
||||
"credentials");
|
||||
|
||||
auto args = depositAuthArgs(alice, becky, "validated");
|
||||
@@ -392,7 +396,7 @@ public:
|
||||
|
||||
{
|
||||
testcase(
|
||||
"deposit_authorized with credentials failed: not a hex string "
|
||||
"deposit_authorized with credentials failure: not a hex string "
|
||||
"credentials");
|
||||
|
||||
auto args = depositAuthArgs(alice, becky, "validated");
|
||||
@@ -412,7 +416,7 @@ public:
|
||||
|
||||
{
|
||||
testcase(
|
||||
"deposit_authorized with credentials failed: not a credential "
|
||||
"deposit_authorized with credentials failure: not a credential "
|
||||
"index");
|
||||
|
||||
auto args = depositAuthArgs(
|
||||
|
||||
@@ -577,6 +577,16 @@ multi_runner_child::on_suite_begin(beast::unit_test::suite_info const& info)
|
||||
void
|
||||
multi_runner_child::on_suite_end()
|
||||
{
|
||||
if (print_log_ || suite_results_.failed > 0)
|
||||
{
|
||||
std::stringstream s;
|
||||
if (num_jobs_ > 1)
|
||||
s << job_index_ << "> ";
|
||||
s << (suite_results_.failed > 0 ? "failed: " : "")
|
||||
<< suite_results_.name << " had " << suite_results_.failed
|
||||
<< " failures." << std::endl;
|
||||
message_queue_send(MessageType::log, s.str());
|
||||
}
|
||||
results_.add(suite_results_);
|
||||
message_queue_send(MessageType::test_end, suite_results_.name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user