Skip to content

Commit de589e1

Browse files
committed
Run tests in parallel via ctest
1 parent 2df0a12 commit de589e1

File tree

15 files changed

+349
-252
lines changed

15 files changed

+349
-252
lines changed

Dockerfile

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ ARG STEEM_STATIC_BUILD=ON
66
ENV STEEM_STATIC_BUILD ${STEEM_STATIC_BUILD}
77
ARG BUILD_STEP
88
ENV BUILD_STEP ${BUILD_STEP}
9+
ARG CI_BUILD
10+
ENV CI_BUILD ${CI_BUILD}
911

1012
ENV LANG=en_US.UTF-8
1113

@@ -53,6 +55,12 @@ RUN \
5355

5456
ADD . /usr/local/src/steem
5557

58+
RUN \
59+
if [ "$CI_BUILD" ] ; then \
60+
pip3 install awscli --user && \
61+
aws s3 cp s3://steemit-dev-ci/steemd-CTestCostData.txt /usr/local/src/steem/CTestCostData.txt ; \
62+
fi
63+
5664
RUN \
5765
if [ "$BUILD_STEP" = "1" ] || [ ! "$BUILD_STEP" ] ; then \
5866
cd /usr/local/src/steem && \
@@ -68,8 +76,13 @@ RUN \
6876
-DENABLE_MIRA=ON \
6977
.. && \
7078
make -j$(nproc) chain_test mira_test test_fixed_string plugin_test && \
71-
./tests/chain_test && \
72-
./tests/plugin_test && \
79+
if [ "$CI_BUILD" ] ; then \
80+
mkdir -p build/tests/Testing/Temporary && \
81+
cp /usr/local/src/steem/CTestCostData.txt build/tests/Testing/Temporary ; \
82+
fi && \
83+
cd tests && \
84+
ctest -j8 --output-on-failure && \
85+
cd .. && \
7386
./libraries/mira/test/mira_test && \
7487
./programs/util/test_fixed_string && \
7588
cd /usr/local/src/steem && \
@@ -99,14 +112,23 @@ RUN \
99112
.. && \
100113
make -j$(nproc) chain_test test_fixed_string plugin_test && \
101114
make install && \
102-
./tests/chain_test && \
103-
./tests/plugin_test && \
115+
if [ "$CI_BUILD" ] ; then \
116+
mkdir -p build/tests/Testing/Temporary && \
117+
cp /usr/local/src/steem/CTestCostData.txt build/tests/Testing/Temporary ; \
118+
fi && \
119+
cd tests && \
120+
ctest -j8 --output-on-failure && \
121+
cd .. && \
104122
./programs/util/test_fixed_string && \
105123
cd /usr/local/src/steem && \
106124
doxygen && \
107125
PYTHONPATH=programs/build_helpers \
108126
python3 -m steem_build_helpers.check_reflect && \
109127
programs/build_helpers/get_config_check.sh && \
128+
if [ "$CI_BUILD" ] ; then \
129+
aws s3 cp s3://steemit-dev-ci/steemd-CTestCostData.txt s3://steemit-dev-ci/steemd-CTestCostData.txt.bk && \
130+
aws s3 cp build/tests/Testing/Temporary/CTestCostData.txt s3://steemit-dev-ci/steemd-CTestCostData.txt; \
131+
fi && \
110132
rm -rf /usr/local/src/steem/build ; \
111133
fi
112134

@@ -127,8 +149,13 @@ RUN \
127149
-DCHAINBASE_CHECK_LOCKING=OFF \
128150
.. && \
129151
make -j$(nproc) chain_test plugin_test && \
130-
./tests/chain_test && \
131-
./tests/plugin_test && \
152+
if [ "$CI_BUILD" ] ; then \
153+
mkdir -p build/tests/Testing/Temporary && \
154+
cp /usr/local/src/steem/CTestCostData.txt build/tests/Testing/Temporary ; \
155+
fi && \
156+
cd tests && \
157+
ctest -j8 --output-on-failure && \
158+
cd .. && \
132159
mkdir -p /var/cobertura && \
133160
gcovr --object-directory="../" --root=../ --xml-pretty --gcov-exclude=".*tests.*" --gcov-exclude=".*fc.*" --gcov-exclude=".*app*" --gcov-exclude=".*net*" --gcov-exclude=".*plugins*" --gcov-exclude=".*schema*" --gcov-exclude=".*time*" --gcov-exclude=".*utilities*" --gcov-exclude=".*wallet*" --gcov-exclude=".*programs*" --gcov-exclude=".*vendor*" --output="/var/cobertura/coverage.xml" && \
134161
cd /usr/local/src/steem && \

ciscripts/buildscript.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export IMAGE_NAME="steemit/steem:$BRANCH_NAME"
44
if [[ $IMAGE_NAME == "steemit/steem:stable" ]] ; then
55
IMAGE_NAME="steemit/steem:latest"
66
fi
7-
sudo docker build --build-arg BUILD_STEP=2 -t=$IMAGE_NAME .
7+
sudo docker build --build-arg CI_BUILD=1 --build-arg BUILD_STEP=2 -t=$IMAGE_NAME .
88
sudo docker login --username=$DOCKER_USER --password=$DOCKER_PASS
99
sudo docker push $IMAGE_NAME
1010
# make docker cleanup after itself and delete all exited containers

ciscripts/buildtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -e
3-
sudo docker build --build-arg BUILD_STEP=1 -t=steemit/steem:tests .
3+
sudo docker build --build-arg CI_BUILD=1 --build-arg BUILD_STEP=1 -t=steemit/steem:tests .
44
sudo docker run -v $WORKSPACE:/var/jenkins steemit/steem:tests cp -r /var/cobertura /var/jenkins
55
# make docker cleanup after itself and delete all exited containers
66
sudo docker rm -v $(docker ps -a -q -f status=exited) || true

libraries/chain/include/steem/chain/database.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ namespace steem { namespace chain {
3535
using abstract_plugin = appbase::abstract_plugin;
3636

3737
class database;
38+
39+
#ifdef ENABLE_MIRA
3840
using set_index_type_func = std::function< void(database&, mira::index_type, const boost::filesystem::path&, const boost::any&) >;
41+
#endif
3942

4043
struct index_delegate {
44+
#ifdef ENABLE_MIRA
4145
set_index_type_func set_index_type;
46+
#endif
4247
};
4348

4449
using index_delegate_map = std::map< std::string, index_delegate >;

libraries/chain/include/steem/chain/index.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ void add_plugin_index( database& db )
5959

6060
} }
6161

62+
#ifdef ENABLE_MIRA
63+
6264
#define STEEM_ADD_CORE_INDEX(db, index_name) \
6365
do { \
6466
steem::chain::add_core_index< index_name >( db ); \
@@ -78,3 +80,21 @@ void add_plugin_index( database& db )
7880
{ _db.get_mutable_index< index_name >().mutable_indices().set_index_type( type, p, cfg ); }; \
7981
db.set_index_delegate( #index_name, std::move( delegate ) ); \
8082
} while( false )
83+
84+
#else
85+
86+
#define STEEM_ADD_CORE_INDEX(db, index_name) \
87+
do { \
88+
steem::chain::add_core_index< index_name >( db ); \
89+
steem::chain::index_delegate delegate; \
90+
db.set_index_delegate( #index_name, std::move( delegate ) ); \
91+
} while( false )
92+
93+
#define STEEM_ADD_PLUGIN_INDEX(db, index_name) \
94+
do { \
95+
steem::chain::add_plugin_index< index_name >( db ); \
96+
steem::chain::index_delegate delegate; \
97+
db.set_index_delegate( #index_name, std::move( delegate ) ); \
98+
} while( false )
99+
100+
#endif

libraries/chain/index.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ void initialize_core_indexes( database& db )
5656
STEEM_ADD_CORE_INDEX(db, nai_pool_index);
5757
STEEM_ADD_CORE_INDEX(db, smt_token_emissions_index);
5858
#endif
59-
add_core_index< proposal_index >( db );
60-
add_core_index< proposal_vote_index >( db );
59+
STEEM_ADD_CORE_INDEX(db, proposal_index);
60+
STEEM_ADD_CORE_INDEX(db, proposal_vote_index);
6161
}
6262

6363
index_info::index_info() {}

libraries/protocol/include/steem/protocol/version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <fc/string.hpp>
44
#include <fc/time.hpp>
5-
#include <sys/sysmacros.h>
5+
//#include <sys/sysmacros.h>
66

77
namespace steem { namespace protocol {
88

0 commit comments

Comments
 (0)