From 16387f43fe334d8c4a9f4790d2b06e73e031b289 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 12:16:25 -0500 Subject: [PATCH 01/22] Whitespace correction in wasm_tests.cpp --- unittests/wasm_tests.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unittests/wasm_tests.cpp b/unittests/wasm_tests.cpp index ce351e2042c..45103a00505 100644 --- a/unittests/wasm_tests.cpp +++ b/unittests/wasm_tests.cpp @@ -512,16 +512,16 @@ BOOST_FIXTURE_TEST_CASE(misaligned_tests, tester ) try { // test weighted cpu limit BOOST_FIXTURE_TEST_CASE(weighted_cpu_limit_tests, tester ) try { -// TODO Increase the robustness of this test. + // TODO Increase the robustness of this test. resource_limits_manager mgr = control->get_mutable_resource_limits_manager(); create_accounts( {N(f_tests)} ); create_accounts( {N(acc2)} ); bool pass = false; std::string code = R"=====( -(module - (import "env" "require_auth" (func $require_auth (param i64))) - (import "env" "eosio_assert" (func $eosio_assert (param i32 i32))) + (module + (import "env" "require_auth" (func $require_auth (param i64))) + (import "env" "eosio_assert" (func $eosio_assert (param i32 i32))) (table 0 anyfunc) (memory $0 1) (export "apply" (func $apply)) From 633c740c154c29f071523be90a972d44fcf766d7 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 12:17:42 -0500 Subject: [PATCH 02/22] ctest now runs tests on all available cores --- tools/ctestwrapper.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ctestwrapper.sh b/tools/ctestwrapper.sh index 271cb12c556..da7a9de75c8 100755 --- a/tools/ctestwrapper.sh +++ b/tools/ctestwrapper.sh @@ -1,4 +1,4 @@ #!/bin/sh -# run ctest, disregard failure code -ctest --output-on-failure $@ +CORES=`getconf _NPROCESSORS_ONLN` # determine number of cores available +ctest --parallel $CORES --output-on-failure $@ # run ctest, disregard failure code exit 0 From c679cb26a58765fb49a769da34fb761fc641f2d6 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 14:18:09 -0500 Subject: [PATCH 03/22] Removed references to zombie variable in CMake --- tests/CMakeLists.txt | 2 +- unittests/CMakeLists.txt | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9f545c378b2..66a826fa0e6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,7 +15,7 @@ include_directories("${CMAKE_SOURCE_DIR}/plugins/wallet_plugin/include") file(GLOB UNIT_TESTS "*.cpp") -add_executable( plugin_test ${UNIT_TESTS} ${WASM_UNIT_TESTS} ) +add_executable( plugin_test ${UNIT_TESTS} ) target_link_libraries( plugin_test eosio_testing eosio_chain chainbase chain_plugin wallet_plugin fc ${PLATFORM_SPECIFIC_LIBS} ) target_include_directories( plugin_test PUBLIC diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 0d789225f6b..214e927e001 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -40,13 +40,10 @@ add_subdirectory(contracts) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.hpp ESCAPE_QUOTES) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contracts.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/contracts.hpp ESCAPE_QUOTES) -file(GLOB UNIT_TESTS "*.cpp") - -add_executable( unit_test ${UNIT_TESTS} ${WASM_UNIT_TESTS} ) +file(GLOB UNIT_TESTS "*.cpp") # find all unit test suites +add_executable( unit_test ${UNIT_TESTS}) # build unit tests as one executable target_link_libraries( unit_test eosio_chain chainbase eosio_testing fc ${PLATFORM_SPECIFIC_LIBS} ) - target_compile_options(unit_test PUBLIC -DDISABLE_EOSLIB_SERIALIZE) - target_include_directories( unit_test PUBLIC ${CMAKE_SOURCE_DIR}/libraries/testing/include ${CMAKE_SOURCE_DIR}/test-contracts From e65e82b4429d4ab0c35da25f7b803bf2da3e6fc0 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 17:22:31 -0500 Subject: [PATCH 04/22] Unit tests are now added to test execution by test suite, rather than as one batch --- unittests/CMakeLists.txt | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 214e927e001..f045be6069f 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -1,6 +1,6 @@ find_package( Gperftools QUIET ) -### Build contracts with cdt if available +### Build contracts with cdt if available ### include(ExternalProject) # if no cdt root is given use default path if(EOSIO_CDT_ROOT STREQUAL "" OR NOT EOSIO_CDT_ROOT) @@ -40,6 +40,7 @@ add_subdirectory(contracts) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.hpp ESCAPE_QUOTES) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contracts.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/contracts.hpp ESCAPE_QUOTES) +### BUILD UNIT TEST EXECUTABLE ### file(GLOB UNIT_TESTS "*.cpp") # find all unit test suites add_executable( unit_test ${UNIT_TESTS}) # build unit tests as one executable target_link_libraries( unit_test eosio_chain chainbase eosio_testing fc ${PLATFORM_SPECIFIC_LIBS} ) @@ -52,15 +53,27 @@ target_include_directories( unit_test PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/contracts ${CMAKE_CURRENT_BINARY_DIR}/include ) -#Manually run unit_test for all supported runtimes -#To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose -add_test(NAME unit_test_wavm COMMAND unit_test - -t \!wasm_tests/weighted_cpu_limit_tests - --report_level=detailed --color_output --catch_system_errors=no -- --wavm) - add_test(NAME unit_test_wabt COMMAND unit_test - -t \!wasm_tests/weighted_cpu_limit_tests - --report_level=detailed --color_output -- --wabt) - +### +foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite + execute_process(COMMAND bash -c "grep 'BOOST_AUTO_TEST_SUITE(' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file + execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} + #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose + if("wasm" STREQUAL "${TRIMMED_SUITE_NAME}") # edge case: exclude some test cases + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output --catch_system_errors=no -- --wavm) + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output -- --wabt) + else() # run all test cases + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output --catch_system_errors=no -- --wavm) + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output -- --wabt) + endif() + # build list of tests to run during coverage testing + if(${ctest_tests}) + set(ctest_tests "${ctest_tests},${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + else() + set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + endif() +endforeach(TEST_SUITE) + +### COVERAGE TESTING ### if(ENABLE_COVERAGE_TESTING) set(Coverage_NAME ${PROJECT_NAME}_ut_coverage) @@ -78,7 +91,7 @@ if(ENABLE_COVERAGE_TESTING) endif() # NOT GENHTML_PATH # no spaces allowed within tests list - set(ctest_tests 'unit_test_wabt|unit_test_wavm') + # set(ctest_tests 'unit_test_wabt|unit_test_wavm') set(ctest_exclude_tests '') # Setup target From f4b2c42002c39529fbf942f38ff8ab1c5758301c Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 18:34:22 -0500 Subject: [PATCH 05/22] Added error checking for empty lines, cleaned up comments --- unittests/CMakeLists.txt | 70 +++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index f045be6069f..06e6fa34994 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -53,71 +53,59 @@ target_include_directories( unit_test PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/contracts ${CMAKE_CURRENT_BINARY_DIR}/include ) -### +### MARK TEST SUITES FOR EXECUTION ### foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite execute_process(COMMAND bash -c "grep 'BOOST_AUTO_TEST_SUITE(' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file - execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} - #To run unit_test with all log from blockchain displayed, put --verbose after --, i.e. unit_test -- --verbose - if("wasm" STREQUAL "${TRIMMED_SUITE_NAME}") # edge case: exclude some test cases - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output --catch_system_errors=no -- --wavm) - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output -- --wabt) - else() # run all test cases - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output --catch_system_errors=no -- --wavm) - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output -- --wabt) - endif() - # build list of tests to run during coverage testing - if(${ctest_tests}) - set(ctest_tests "${ctest_tests},${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") - else() - set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines + execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} + # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" + if("wasm" STREQUAL "${TRIMMED_SUITE_NAME}") # edge case: exclude some test cases from suite + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output --catch_system_errors=no -- --wavm) + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output -- --wabt) + else() # run all test cases in suite + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output --catch_system_errors=no -- --wavm) + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output -- --wabt) + endif() + # build list of tests to run during coverage testing + if(${ctest_tests}) + set(ctest_tests "${ctest_tests},${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + else() + set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + endif() endif() endforeach(TEST_SUITE) ### COVERAGE TESTING ### if(ENABLE_COVERAGE_TESTING) - set(Coverage_NAME ${PROJECT_NAME}_ut_coverage) - + # check for dependencies if(NOT LCOV_PATH) message(FATAL_ERROR "lcov not found! Aborting...") - endif() # NOT LCOV_PATH - + endif() if(NOT LLVMCOV_PATH) message(FATAL_ERROR "llvm-cov not found! Aborting...") - endif() # NOT LCOV_PATH - + endif() if(NOT GENHTML_PATH) message(FATAL_ERROR "genhtml not found! Aborting...") - endif() # NOT GENHTML_PATH - - # no spaces allowed within tests list - # set(ctest_tests 'unit_test_wabt|unit_test_wavm') - set(ctest_exclude_tests '') - - # Setup target + endif() + # tests to skip during coverage testing + set(ctest_exclude_tests '') # no spaces allowed within tests list + # setup target add_custom_target(${Coverage_NAME} - - # Cleanup lcov + # cleanup lcov COMMAND ${LCOV_PATH} --directory . --zerocounters - - # Run tests + # run tests COMMAND ./tools/ctestwrapper.sh -R ${ctest_tests} -E ${ctest_exclude_tests} - COMMAND ${LCOV_PATH} --directory . --capture --gcov-tool ${CMAKE_SOURCE_DIR}/tools/llvm-gcov.sh --output-file ${Coverage_NAME}.info - COMMAND ${LCOV_PATH} -remove ${Coverage_NAME}.info '*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/fc/*' '*/wasm-jit/*' --output-file ${Coverage_NAME}_filtered.info - COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info - COMMAND if [ "$CI" != "true" ]\; then ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base ${Coverage_NAME}.info ${Coverage_NAME}_filtered.info ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info.cleaned\; fi - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report. Report published in ./${Coverage_NAME}" - ) - - # Show info where to find the report + ) + # show info where to find the report add_custom_command(TARGET ${Coverage_NAME} POST_BUILD COMMAND ; COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report." - ) + ) endif() From 644b8ab0517242a2c4de07c6970247e63036a7f3 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 18:46:06 -0500 Subject: [PATCH 06/22] Set Buildkite to automagically determine number of cores for parallelization --- .buildkite/pipeline.yml | 63 ++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2d38281560e..deac47e29f5 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,4 +1,5 @@ steps: + ### BUILDS ### - command: | echo "--- Creating symbolic link to job directory :file_folder:" && \ sleep 5 && ln -s "$(pwd)" /data/job && cd /data/job && \ @@ -115,6 +116,7 @@ steps: workdir: /data/job timeout: 60 + ### TESTS ### - wait - command: | @@ -124,7 +126,11 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + ln -s "$(pwd)" /data/job && \ + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":darwin: High Sierra Tests" agents: - "role=macos-tester" @@ -142,7 +148,9 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + ln -s "$(pwd)" /data/job && \ + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":darwin: High Sierra NP Tests" agents: - "role=macos-tester" @@ -159,7 +167,11 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + ln -s "$(pwd)" /data/job && \ + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":darwin: Mojave Tests" agents: - "role=tester" @@ -177,7 +189,9 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + ln -s "$(pwd)" /data/job && \ + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":darwin: Mojave NP Tests" agents: - "role=tester" @@ -195,7 +209,10 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":ubuntu: Tests" agents: queue: "automation-large-builder-fleet" @@ -216,7 +233,8 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":ubuntu: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -237,7 +255,10 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":ubuntu: 18.04 Tests" agents: queue: "automation-large-builder-fleet" @@ -258,7 +279,8 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":ubuntu: 18.04 NP Tests" agents: queue: "automation-large-builder-fleet" @@ -279,7 +301,10 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":fedora: Tests" agents: queue: "automation-large-builder-fleet" @@ -300,7 +325,8 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":fedora: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -321,7 +347,10 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":centos: Tests" agents: queue: "automation-large-builder-fleet" @@ -342,7 +371,8 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":centos: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -363,7 +393,10 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -j8 -LE _tests --output-on-failure + cd /data/job/build && \ + CORES=`getconf _NPROCESSORS_ONLN` && \ + echo "$CORES CPU cores found, testing on all cores" && \ + ctest -j $CORES -LE _tests --output-on-failure label: ":aws: Tests" agents: queue: "automation-large-builder-fleet" @@ -384,7 +417,8 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && \ + ctest -L nonparallelizable_tests --output-on-failure label: ":aws: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -398,6 +432,7 @@ steps: workdir: /data/job timeout: 60 + ### PACKAGES ### - wait - command: | From 207b8be811cf7fdd206fb37223e81632389d3b58 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 18:49:54 -0500 Subject: [PATCH 07/22] Fixed incorrect ctest command-line option --- tools/ctestwrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ctestwrapper.sh b/tools/ctestwrapper.sh index da7a9de75c8..a0d59e7c2b4 100755 --- a/tools/ctestwrapper.sh +++ b/tools/ctestwrapper.sh @@ -1,4 +1,4 @@ #!/bin/sh CORES=`getconf _NPROCESSORS_ONLN` # determine number of cores available -ctest --parallel $CORES --output-on-failure $@ # run ctest, disregard failure code +ctest --j $CORES --output-on-failure $@ # run ctest, disregard failure code exit 0 From f94690e555b6ef6f9987617da395d7ddc04ed418 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Thu, 7 Feb 2019 19:32:55 -0500 Subject: [PATCH 08/22] Changed how CPU cores are detected in Buildkite --- .buildkite/pipeline.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index deac47e29f5..be9bcffd53f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -128,7 +128,7 @@ steps: echo "+++ :microscope: Running tests" && \ ln -s "$(pwd)" /data/job && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`sysctl -n hw.ncpu` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":darwin: High Sierra Tests" @@ -169,7 +169,7 @@ steps: echo "+++ :microscope: Running tests" && \ ln -s "$(pwd)" /data/job && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`sysctl -n hw.ncpu` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":darwin: Mojave Tests" @@ -210,7 +210,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`grep -c processor /proc/cpuinfo` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":ubuntu: Tests" @@ -256,7 +256,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`grep -c processor /proc/cpuinfo` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":ubuntu: 18.04 Tests" @@ -302,7 +302,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`grep -c processor /proc/cpuinfo` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":fedora: Tests" @@ -348,7 +348,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`grep -c processor /proc/cpuinfo` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":centos: Tests" @@ -394,7 +394,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`getconf _NPROCESSORS_ONLN` && \ + CORES=`grep -c processor /proc/cpuinfo` && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":aws: Tests" From b4d13d510f1636c8f9e6d31728f1223552cd3a4d Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 03:28:20 -0500 Subject: [PATCH 09/22] Fixed depricated method of BASH command substitution, testing multiple methods of counting cores in Buildkite containers --- .buildkite/pipeline.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index be9bcffd53f..397857aaf5d 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -128,7 +128,7 @@ steps: echo "+++ :microscope: Running tests" && \ ln -s "$(pwd)" /data/job && \ cd /data/job/build && \ - CORES=`sysctl -n hw.ncpu` && \ + CORES=$(getconf _NPROCESSORS_ONLN) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":darwin: High Sierra Tests" @@ -169,7 +169,7 @@ steps: echo "+++ :microscope: Running tests" && \ ln -s "$(pwd)" /data/job && \ cd /data/job/build && \ - CORES=`sysctl -n hw.ncpu` && \ + CORES=$(sysctl -n hw.ncpu) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":darwin: Mojave Tests" @@ -210,7 +210,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`grep -c processor /proc/cpuinfo` && \ + CORES=$(grep -c processor /proc/cpuinfo) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":ubuntu: Tests" @@ -256,7 +256,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`grep -c processor /proc/cpuinfo` && \ + CORES=$(getconf _NPROCESSORS_ONLN) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":ubuntu: 18.04 Tests" @@ -302,7 +302,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`grep -c processor /proc/cpuinfo` && \ + CORES=$(getconf _NPROCESSORS_ONLN) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":fedora: Tests" @@ -348,7 +348,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`grep -c processor /proc/cpuinfo` && \ + CORES=$(getconf _NPROCESSORS_ONLN) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":centos: Tests" @@ -394,7 +394,7 @@ steps: $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ cd /data/job/build && \ - CORES=`grep -c processor /proc/cpuinfo` && \ + CORES=$(getconf _NPROCESSORS_ONLN) && \ echo "$CORES CPU cores found, testing on all cores" && \ ctest -j $CORES -LE _tests --output-on-failure label: ":aws: Tests" From c0f64f3d3146f9e318372eef4fa6f5debd587d6b Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 03:55:50 -0500 Subject: [PATCH 10/22] Reverted Buildkite configuration --- .buildkite/pipeline.yml | 63 +++++++++-------------------------------- 1 file changed, 14 insertions(+), 49 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 397857aaf5d..2d38281560e 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,5 +1,4 @@ steps: - ### BUILDS ### - command: | echo "--- Creating symbolic link to job directory :file_folder:" && \ sleep 5 && ln -s "$(pwd)" /data/job && cd /data/job && \ @@ -116,7 +115,6 @@ steps: workdir: /data/job timeout: 60 - ### TESTS ### - wait - command: | @@ -126,11 +124,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && \ - cd /data/job/build && \ - CORES=$(getconf _NPROCESSORS_ONLN) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":darwin: High Sierra Tests" agents: - "role=macos-tester" @@ -148,9 +142,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":darwin: High Sierra NP Tests" agents: - "role=macos-tester" @@ -167,11 +159,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && \ - cd /data/job/build && \ - CORES=$(sysctl -n hw.ncpu) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":darwin: Mojave Tests" agents: - "role=tester" @@ -189,9 +177,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - ln -s "$(pwd)" /data/job && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + ln -s "$(pwd)" /data/job && cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":darwin: Mojave NP Tests" agents: - "role=tester" @@ -209,10 +195,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - CORES=$(grep -c processor /proc/cpuinfo) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":ubuntu: Tests" agents: queue: "automation-large-builder-fleet" @@ -233,8 +216,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":ubuntu: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -255,10 +237,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - CORES=$(getconf _NPROCESSORS_ONLN) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":ubuntu: 18.04 Tests" agents: queue: "automation-large-builder-fleet" @@ -279,8 +258,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":ubuntu: 18.04 NP Tests" agents: queue: "automation-large-builder-fleet" @@ -301,10 +279,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - CORES=$(getconf _NPROCESSORS_ONLN) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":fedora: Tests" agents: queue: "automation-large-builder-fleet" @@ -325,8 +300,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":fedora: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -347,10 +321,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - CORES=$(getconf _NPROCESSORS_ONLN) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":centos: Tests" agents: queue: "automation-large-builder-fleet" @@ -371,8 +342,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":centos: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -393,10 +363,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - CORES=$(getconf _NPROCESSORS_ONLN) && \ - echo "$CORES CPU cores found, testing on all cores" && \ - ctest -j $CORES -LE _tests --output-on-failure + cd /data/job/build && ctest -j8 -LE _tests --output-on-failure label: ":aws: Tests" agents: queue: "automation-large-builder-fleet" @@ -417,8 +384,7 @@ steps: echo "--- :m: Starting MongoDB" && \ $(which mongod) --fork --logpath "$(pwd)"/mongod.log && \ echo "+++ :microscope: Running tests" && \ - cd /data/job/build && \ - ctest -L nonparallelizable_tests --output-on-failure + cd /data/job/build && ctest -L nonparallelizable_tests --output-on-failure label: ":aws: NP Tests" agents: queue: "automation-large-builder-fleet" @@ -432,7 +398,6 @@ steps: workdir: /data/job timeout: 60 - ### PACKAGES ### - wait - command: | From d1eea60cb2582cedd7a62dac0cd8bbada07151ac Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 10:04:07 -0500 Subject: [PATCH 11/22] Reverted /tools/ctestwrapper.sh --- tools/ctestwrapper.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ctestwrapper.sh b/tools/ctestwrapper.sh index a0d59e7c2b4..271cb12c556 100755 --- a/tools/ctestwrapper.sh +++ b/tools/ctestwrapper.sh @@ -1,4 +1,4 @@ #!/bin/sh -CORES=`getconf _NPROCESSORS_ONLN` # determine number of cores available -ctest --j $CORES --output-on-failure $@ # run ctest, disregard failure code +# run ctest, disregard failure code +ctest --output-on-failure $@ exit 0 From d020e58a0d372f56e66bc48ff71a488db3181c9e Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 10:16:42 -0500 Subject: [PATCH 12/22] Fixed delimiter when specifying tests to include in coverage report --- unittests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 06e6fa34994..04922433ff0 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -68,9 +68,9 @@ foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test s endif() # build list of tests to run during coverage testing if(${ctest_tests}) - set(ctest_tests "${ctest_tests},${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + set(ctest_tests "${ctest_tests}|${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") else() - set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm,${TRIMMED_SUITE_NAME}_unit_test_wabt") + set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") endif() endif() endforeach(TEST_SUITE) From 4a2bb7b7e055ee067a9bda4cdbc54ee6d51bc514 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 10:39:07 -0500 Subject: [PATCH 13/22] Fixed CMake string concatenation issue --- unittests/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 04922433ff0..7e6e7fe4cf0 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -68,7 +68,8 @@ foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test s endif() # build list of tests to run during coverage testing if(${ctest_tests}) - set(ctest_tests "${ctest_tests}|${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") + set(ctest_tests_swap "${ctest_tests}") + set(ctest_tests "${ctest_tests_swap}|${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") else() set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") endif() From 5d2e6e3e9f7340c862a0cea17c1d8cbe8dc88afd Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 11:41:55 -0500 Subject: [PATCH 14/22] Fixed empty string checking in CMake --- unittests/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 7e6e7fe4cf0..1a1df15fd08 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -67,9 +67,8 @@ foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test s add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output -- --wabt) endif() # build list of tests to run during coverage testing - if(${ctest_tests}) - set(ctest_tests_swap "${ctest_tests}") - set(ctest_tests "${ctest_tests_swap}|${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") + if(NOT "" STREQUAL "${ctest_tests}") + set(ctest_tests "${ctest_tests}|${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") else() set(ctest_tests "${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") endif() From c84f185e05c6e0f45193d9e9ef3b80406e4464b7 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Fri, 8 Feb 2019 14:09:50 -0500 Subject: [PATCH 15/22] Finally fixed coverage testing --- unittests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 1a1df15fd08..7505fadcb13 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -74,6 +74,7 @@ foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test s endif() endif() endforeach(TEST_SUITE) +set(ctest_tests "'${ctest_tests}' -j8") # surround test list string in apostrophies ### COVERAGE TESTING ### if(ENABLE_COVERAGE_TESTING) From 6df6b23d92db7fa7afa9051ab87f8b2c84edfeb1 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 14:24:28 -0500 Subject: [PATCH 16/22] Added regex to grep command to ignore whitespace as spoonincode suggested --- unittests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 7505fadcb13..6fbf28995cb 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -55,7 +55,7 @@ target_include_directories( unit_test PUBLIC ### MARK TEST SUITES FOR EXECUTION ### foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite - execute_process(COMMAND bash -c "grep 'BOOST_AUTO_TEST_SUITE(' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file + execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\s*[(]' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" From 78db535995d1a901dab6bb615b24e7c9a1e0434a Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 14:37:05 -0500 Subject: [PATCH 17/22] Removed wasm_tests/weighted_cpu_limit_tests test exclusion edge case from CMakeLists.txt --- unittests/CMakeLists.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 6fbf28995cb..1c68380e7be 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -59,13 +59,8 @@ foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test s if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" - if("wasm" STREQUAL "${TRIMMED_SUITE_NAME}") # edge case: exclude some test cases from suite - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output --catch_system_errors=no -- --wavm) - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=wasm_tests -t \!wasm_tests/weighted_cpu_limit_tests --report_level=detailed --color_output -- --wabt) - else() # run all test cases in suite - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output --catch_system_errors=no -- --wavm) - add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output -- --wabt) - endif() + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wavm COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output --catch_system_errors=no -- --wavm) + add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test_wabt COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output -- --wabt) # build list of tests to run during coverage testing if(NOT "" STREQUAL "${ctest_tests}") set(ctest_tests "${ctest_tests}|${TRIMMED_SUITE_NAME}_unit_test_wavm|${TRIMMED_SUITE_NAME}_unit_test_wabt") From 1a3610dbb4e4b3075812e294950c7bfceedf6025 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 14:39:23 -0500 Subject: [PATCH 18/22] Deleted wasm_tests/weighted_cpu_limit_tests as flaky tests are useless tests, confirmed with Areg and Bucky --- unittests/wasm_tests.cpp | 63 ---------------------------------------- 1 file changed, 63 deletions(-) diff --git a/unittests/wasm_tests.cpp b/unittests/wasm_tests.cpp index 45103a00505..673da4e4c20 100644 --- a/unittests/wasm_tests.cpp +++ b/unittests/wasm_tests.cpp @@ -510,69 +510,6 @@ BOOST_FIXTURE_TEST_CASE(misaligned_tests, tester ) try { check_aligned(misaligned_const_ref_wast); } FC_LOG_AND_RETHROW() -// test weighted cpu limit -BOOST_FIXTURE_TEST_CASE(weighted_cpu_limit_tests, tester ) try { - // TODO Increase the robustness of this test. - resource_limits_manager mgr = control->get_mutable_resource_limits_manager(); - create_accounts( {N(f_tests)} ); - create_accounts( {N(acc2)} ); - bool pass = false; - - std::string code = R"=====( - (module - (import "env" "require_auth" (func $require_auth (param i64))) - (import "env" "eosio_assert" (func $eosio_assert (param i32 i32))) - (table 0 anyfunc) - (memory $0 1) - (export "apply" (func $apply)) - (func $i64_trunc_u_f64 (param $0 f64) (result i64) (i64.trunc_u/f64 (get_local $0))) - (func $test (param $0 i64)) - (func $apply (param $0 i64)(param $1 i64)(param $2 i64) - )====="; - for (int i = 0; i < 1024; ++i) { - code += "(call $test (call $i64_trunc_u_f64 (f64.const 1)))\n"; - } - code += "))"; - - produce_blocks(1); - set_code(N(f_tests), code.c_str()); - produce_blocks(10); - - mgr.set_account_limits(N(f_tests), -1, -1, 1); - int count = 0; - while (count < 4) { - signed_transaction trx; - - for (int i = 0; i < 2; ++i) { - action act; - act.account = N(f_tests); - act.name = N() + (i * 16); - act.authorization = vector{{N(f_tests),config::active_name}}; - trx.actions.push_back(act); - } - - set_transaction_headers(trx); - trx.sign(get_private_key( N(f_tests), "active" ), control->get_chain_id()); - - try { - push_transaction(trx, fc::time_point::maximum(), 0); - produce_block(); - BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - pass = true; - count++; - } catch( eosio::chain::leeway_deadline_exception& ) { - BOOST_REQUIRE_EQUAL(count, 3); - break; - } - BOOST_REQUIRE_EQUAL(true, validate()); - - if (count == 2) { // add a big weight on acc2, making f_tests out of resource - mgr.set_account_limits(N(acc2), -1, -1, 100000000); - } - } - BOOST_REQUIRE_EQUAL(count, 3); -} FC_LOG_AND_RETHROW() - /** * Make sure WASM "start" method is used correctly */ From f35211f583504ff76b9dd2d7f1b84603daa1d332 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 14:49:36 -0500 Subject: [PATCH 19/22] Fixed escape character conflicting between CMake and regex --- unittests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 1c68380e7be..4afc0289367 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -55,7 +55,7 @@ target_include_directories( unit_test PUBLIC ### MARK TEST SUITES FOR EXECUTION ### foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite - execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\s*[(]' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file + execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" From c1564d2140422432d19ae4d9f698697e73b0b7f4 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 17:08:46 -0500 Subject: [PATCH 20/22] Now grep ignores single-line comments containing test suite declarations --- unittests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 4afc0289367..eaad652246c 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -55,7 +55,7 @@ target_include_directories( unit_test PUBLIC ### MARK TEST SUITES FOR EXECUTION ### foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite - execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file + execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -v '//' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" From 1dcb2bd765228f3dc6d7d265d836ae93847880c9 Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 17:17:18 -0500 Subject: [PATCH 21/22] Grep queries now ignore lines where a test suite declaration has been commented out --- unittests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index eaad652246c..06eb34f999b 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -55,7 +55,7 @@ target_include_directories( unit_test PUBLIC ### MARK TEST SUITES FOR EXECUTION ### foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite - execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -v '//' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file + execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -vE '//.*BOOST_AUTO_TEST_SUITE\s*[(]' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" From 57f747e45d466e9ee5ca106880b4a052d89aa91c Mon Sep 17 00:00:00 2001 From: Zach Butler Date: Mon, 11 Feb 2019 17:20:53 -0500 Subject: [PATCH 22/22] Fixed escape character conflicting between CMake and regex --- unittests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 06eb34f999b..3433aea3083 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -55,7 +55,7 @@ target_include_directories( unit_test PUBLIC ### MARK TEST SUITES FOR EXECUTION ### foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite - execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -vE '//.*BOOST_AUTO_TEST_SUITE\s*[(]' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file + execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -vE '//.*BOOST_AUTO_TEST_SUITE\\s*[(]' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose"