Skip to content

Commit 88776c2

Browse files
author
MarcoFalke
committed
Merge #20245: test: Run script_assets_test even if built --with-libs=no
fa3967e test: Replace ARRAYLEN with C++11 ranged for loop (MarcoFalke) fafc529 test: Run AssetTest even if built --with-libs=no (MarcoFalke) faf58ab ci: Add --with-libs=no to one ci config (MarcoFalke) Pull request description: `script_assets_test` doesn't call libbitcoinconsensus, so it seems confusing to require it ACKs for top commit: fanquake: ACK fa3967e - looks ok to me. Tree-SHA512: 8744fef64c5d7dc19a0ef4ae9b3df5b3f356253bf000f12723064794c5e50df071824d436059985f1112d94c1b530b65cbeb6b8435114a91b195480620eafc59
2 parents 5d32009 + fa3967e commit 88776c2

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

ci/test/00_setup_env_native_qt5.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true"
1616
export RUN_UNIT_TESTS="false"
1717
export GOAL="install"
1818
export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.2 v0.16.3 v0.17.2 v0.18.1 v0.19.1"
19-
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-c++17 --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --with-boost-process"
19+
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-c++17 --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --with-boost-process"

src/test/script_tests.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ static ScriptErrorDesc script_errors[]={
106106

107107
static std::string FormatScriptError(ScriptError_t err)
108108
{
109-
for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i)
110-
if (script_errors[i].err == err)
111-
return script_errors[i].name;
109+
for (const auto& se : script_errors)
110+
if (se.err == err)
111+
return se.name;
112112
BOOST_ERROR("Unknown scripterror enumeration value, update script_errors in script_tests.cpp.");
113113
return "";
114114
}
115115

116-
static ScriptError_t ParseScriptError(const std::string &name)
116+
static ScriptError_t ParseScriptError(const std::string& name)
117117
{
118-
for (unsigned int i=0; i<ARRAYLEN(script_errors); ++i)
119-
if (script_errors[i].name == name)
120-
return script_errors[i].err;
118+
for (const auto& se : script_errors)
119+
if (se.name == name)
120+
return se.err;
121121
BOOST_ERROR("Unknown scripterror \"" << name << "\" in test description");
122122
return SCRIPT_ERR_UNKNOWN_ERROR;
123123
}
@@ -1470,8 +1470,6 @@ BOOST_AUTO_TEST_CASE(script_HasValidOps)
14701470
BOOST_CHECK(!script.HasValidOps());
14711471
}
14721472

1473-
#if defined(HAVE_CONSENSUS_LIB)
1474-
14751473
static CMutableTransaction TxFromHex(const std::string& str)
14761474
{
14771475
CMutableTransaction tx;
@@ -1502,6 +1500,8 @@ static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
15021500
return scriptwitness;
15031501
}
15041502

1503+
#if defined(HAVE_CONSENSUS_LIB)
1504+
15051505
/* Test simple (successful) usage of bitcoinconsensus_verify_script */
15061506
BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_returns_true)
15071507
{
@@ -1640,6 +1640,8 @@ BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_invalid_flags)
16401640
BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_INVALID_FLAGS);
16411641
}
16421642

1643+
#endif // defined(HAVE_CONSENSUS_LIB)
1644+
16431645
static std::vector<unsigned int> AllConsensusFlags()
16441646
{
16451647
std::vector<unsigned int> ret;
@@ -1742,5 +1744,4 @@ BOOST_AUTO_TEST_CASE(script_assets_test)
17421744
file.close();
17431745
}
17441746

1745-
#endif
17461747
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)