Skip to content

Commit

Permalink
Merge pull request #2148 from bitshares/msgs-on-testing
Browse files Browse the repository at this point in the history
Show more detailed messages when running test cases in CI
  • Loading branch information
abitmore authored May 8, 2020
2 parents b68a791 + 9e48083 commit 320252b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ jobs:
df -h
- name: Unit-Tests
run: |
_build/tests/app_test
_build/tests/es_test
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test
libraries/fc/tests/run-parallel-tests.sh _build/tests/cli_test
_build/tests/app_test -l message
_build/tests/es_test -l message
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test -l message
libraries/fc/tests/run-parallel-tests.sh _build/tests/cli_test -l message
df -h
- name: Node-Test
run: |
Expand Down Expand Up @@ -146,12 +146,12 @@ jobs:
df -h
- name: Unit-Tests
run: |
_build/tests/app_test
_build/tests/app_test -l message
df -h
_build/tests/es_test
_build/tests/es_test -l message
df -h
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test
libraries/fc/tests/run-parallel-tests.sh _build/tests/cli_test
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test -l message
libraries/fc/tests/run-parallel-tests.sh _build/tests/cli_test -l message
df -h
- name: Node-Test
run: |
Expand Down Expand Up @@ -336,9 +336,9 @@ jobs:
df -h
- name: Unit-Tests
run: |
_build/tests/app_test
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test
libraries/fc/tests/run-parallel-tests.sh _build/tests/cli_test
_build/tests/app_test -l message
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test -l message
libraries/fc/tests/run-parallel-tests.sh _build/tests/cli_test -l message
df -h
- name: Node-Test
run: |
Expand Down
6 changes: 3 additions & 3 deletions programs/build_helpers/build_and_test
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ programs/build_helpers/buildstep -s 3500
ccache -s
programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt"
programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ."
programs/build_helpers/buildstep make.everything 2400 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node chain_test cli_test"
programs/build_helpers/buildstep make.everything 2400 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node cli_wallet chain_test cli_test"
set -o pipefail
programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test"
programs/build_helpers/buildstep run.cli_test 60 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test"
programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test -l message"
programs/build_helpers/buildstep run.cli_test 60 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test -l message"
programs/build_helpers/buildstep prepare.sonar 20 "find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d -print | while read d; do gcov -o \"\$d\" \"\${d/CMakeFiles*.dir//}\"/*.cpp; done >/dev/null; programs/build_helpers/set_sonar_branch sonar-project.properties"
du -hs sonar_cache
# The first pass, skip some files. This will remove the skipped files from the cache, but is an acceptable trade-off
Expand Down
5 changes: 4 additions & 1 deletion programs/build_helpers/scan_with_sonar
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ programs/build_helpers/buildstep -s 3500
ccache -s
programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt"
programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ."
programs/build_helpers/buildstep make.everything 2400 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node chain_test cli_test"
programs/build_helpers/buildstep make.programs 2400 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node cli_wallet"
set -o pipefail
programs/build_helpers/buildstep prepare.sonar 20 "find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d -print | while read d; do gcov -o \"\$d\" \"\${d/CMakeFiles*.dir//}\"/*.cpp; done >/dev/null; programs/build_helpers/set_sonar_branch sonar-project.properties"
du -hs sonar_cache
# The first pass, skip some files. This will remove the skipped files from the cache, but is an acceptable trade-off
# Note: since the first pass was done already in `build_and_test`, ideally we don't need to do it again here.
# However, if we skip this step, the second pass below will come with a very low cache hit, don't know why.
# Anyway, a 100% cache hit is expected for this step, so it's fast and it doesn't matter to do it again.
programs/build_helpers/buildstep prepare.sonar.part 1 "cp sonar-project.properties sonar-project.properties.bak; sed -i '/sonar\.exclusions=/d;s/#sonar\.exclusions.part/sonar.exclusions/' sonar-project.properties"
programs/build_helpers/buildstep run.sonar.part 1500 "which sonar-scanner && sonar-scanner"
programs/build_helpers/buildstep prepare.sonar.full 1 "cp sonar-project.properties.bak sonar-project.properties"
Expand Down
13 changes: 4 additions & 9 deletions tests/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ BOOST_AUTO_TEST_CASE( two_node_network )
BOOST_TEST_MESSAGE( "Starting app1 and waiting 500 ms" );
app1.startup();
#ifdef NDEBUG
#define LISTEN_WAIT_TIME (fc::milliseconds(30000))
#define NODE_STARTUP_WAIT_TIME (fc::milliseconds(30000))
#else
#define LISTEN_WAIT_TIME (fc::milliseconds(120000))
#define NODE_STARTUP_WAIT_TIME (fc::milliseconds(120000))
#endif
fc::wait_for( LISTEN_WAIT_TIME, [&app1] () {
fc::wait_for( NODE_STARTUP_WAIT_TIME, [&app1] () {
const auto status = app1.p2p_node()->network_get_info();
return status["listening_on"].as<fc::ip::endpoint>( 5 ).port() == 3939;
});
Expand All @@ -273,12 +273,7 @@ BOOST_AUTO_TEST_CASE( two_node_network )
BOOST_TEST_MESSAGE( "Starting app2 and waiting for connection" );
app2.startup();

#ifdef NDEBUG
#define CONNECT_WAIT_TIME (fc::milliseconds(10000))
#else
#define CONNECT_WAIT_TIME (fc::milliseconds(30000))
#endif
fc::wait_for( CONNECT_WAIT_TIME, [&app1] () { return app1.p2p_node()->get_connection_count() > 0; } );
fc::wait_for( NODE_STARTUP_WAIT_TIME, [&app1] () { return app1.p2p_node()->get_connection_count() > 0; } );

BOOST_REQUIRE_EQUAL(app1.p2p_node()->get_connection_count(), 1u);
BOOST_CHECK_EQUAL(std::string(app1.p2p_node()->get_connected_peers().front().host.get_address()), "127.0.0.1");
Expand Down

0 comments on commit 320252b

Please sign in to comment.