ci: Remove unused errtrace trap ERR #27667

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2305-ci-trap-err- changing 1 files +0 −3
  1. maflcko commented at 8:10 AM on May 16, 2023: member

    This was added in commit 069752b72613b772a9536a3e7f15fa75097f2946, presumably at a time when the functional tests wouldn't capture stderr.

    Now that all tests capture and print stderr on failure, it can be removed. Reference:

    • Unit tests capture via 2>&1:

    https://github.com/bitcoin/bitcoin/blob/d7700d3a26478d9b1648463c188648c7047b1c60/src/Makefile.test.include#L421

    • Functional tests capture as well:

    https://github.com/bitcoin/bitcoin/blob/d7700d3a26478d9b1648463c188648c7047b1c60/test/functional/test_framework/test_node.py#L356

  2. ci: Remove unused errtrace trap ERR fad09b703f
  3. DrahtBot commented at 8:10 AM on May 16, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK fanquake, hebasto

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on May 16, 2023
  5. fanquake approved
  6. fanquake commented at 9:19 AM on May 16, 2023: member

    ACK fad09b703f5c6d8524a09eef771eb4525f9f3225

  7. maflcko commented at 9:34 AM on May 16, 2023: member

    Can be tested with a diff injecting a fault:

    diff --git a/src/init.cpp b/src/init.cpp
    index 52c5780..95839c0 100644
    --- a/src/init.cpp
    +++ b/src/init.cpp
    @@ -891,6 +891,9 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
     
         // Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled.
         if (args.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS)) {
    +           int a{-1};
    +           unsigned b = a;
    +           (void)b;
             if (g_enabled_filter_types.count(BlockFilterType::BASIC) != 1) {
                 return InitError(_("Cannot set -peerblockfilters without -blockfilterindex."));
             }
    diff --git a/src/test/util_threadnames_tests.cpp b/src/test/util_threadnames_tests.cpp
    index ae91393..9b7ad55 100644
    --- a/src/test/util_threadnames_tests.cpp
    +++ b/src/test/util_threadnames_tests.cpp
    @@ -68,6 +68,9 @@ BOOST_AUTO_TEST_CASE(util_threadnames_test_rename_threaded)
             BOOST_CHECK(names.find(TEST_THREAD_NAME_BASE + ToString(i)) != names.end());
         }
     
    +    int a{-1};
    +    unsigned b = a;
    +    (void)b;
     }
     
     BOOST_AUTO_TEST_SUITE_END()
    

    To test for the unit tests:

    podman kill ci_native_asan || true && MAKEJOBS="-j$(nproc)" FILE_ENV="./ci/test/00_setup_env_native_asan.sh" ./ci/test_run_all.sh
    

    With result:

    test/prevector_tests.cpp(17): Test suite "prevector_tests" is skipped because disabled
    test/util_threadnames_tests.cpp(20): Entering test suite "util_threadnames_tests"
    test/util_threadnames_tests.cpp(55): Entering test case "util_threadnames_test_rename_threaded"
    test/util_threadnames_tests.cpp:72:18: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
        [#0](/bitcoin-bitcoin/0/) 0xaaaadddc5720 in util_threadnames_tests::util_threadnames_test_rename_threaded::test_method() src/test/util_threadnames_tests.cpp:72:18
        [#1](/bitcoin-bitcoin/1/) 0xaaaadddc38b8 in util_threadnames_tests::util_threadnames_test_rename_threaded_invoker() src/test/util_threadnames_tests.cpp:55:1
        [#2](/bitcoin-bitcoin/2/) 0xaaaadcbe5304 in boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14
        [#3](/bitcoin-bitcoin/3/) 0xaaaadcc62fd0 in boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32
        [#4](/bitcoin-bitcoin/4/) 0xaaaadcc62fd0 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18
        [#5](/bitcoin-bitcoin/5/) 0xaaaadcc5c438 in boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14
        [#6](/bitcoin-bitcoin/6/) 0xaaaadcb32318 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30
        [#7](/bitcoin-bitcoin/7/) 0xaaaadcb32318 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16
        [#8](/bitcoin-bitcoin/8/) 0xaaaadcb32748 in boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16
        [#9](/bitcoin-bitcoin/9/) 0xaaaadcb24758 in boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5
        [#10](/bitcoin-bitcoin/10/) 0xaaaadcb2b444 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9
        [#11](/bitcoin-bitcoin/11/) 0xaaaadcba4eac in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44
        [#12](/bitcoin-bitcoin/12/) 0xaaaadcba3e90 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:784:58
        [#13](/bitcoin-bitcoin/13/) 0xaaaadcba3e90 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:784:58
        [#14](/bitcoin-bitcoin/14/) 0xaaaadcb297fc in boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1721:29
        [#15](/bitcoin-bitcoin/15/) 0xaaaadcb5a9a8 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9
        [#16](/bitcoin-bitcoin/16/) 0xffff9fb66dbc  (/lib/aarch64-linux-gnu/libc.so.6+0x26dbc) (BuildId: 9efe43e32e614cad22a180ef036eea6154eafdc2)
        [#17](/bitcoin-bitcoin/17/) 0xffff9fb66e94 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x26e94) (BuildId: 9efe43e32e614cad22a180ef036eea6154eafdc2)
        [#18](/bitcoin-bitcoin/18/) 0xaaaadca2bf6c in _start (/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src/test/test_bitcoin+0x107bf6c) (BuildId: e6232accf8d12124a11d947626dab631bc8c9c37)
    
    SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change test/util_threadnames_tests.cpp:72:18 in 
    make[3]: *** [Makefile:22120: test/util_threadnames_tests.cpp.test] Error 1
    make[3]: *** Waiting for unfinished jobs....
    make[3]: Leaving directory '/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src'
    make[2]: *** [Makefile:20096: check-am] Error 2
    make[2]: Leaving directory '/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src'
    make[1]: *** [Makefile:19761: check-recursive] Error 1
    make[1]: Leaving directory '/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src'
    make: *** [Makefile:816: check-recursive] Error 1
    

    To test for the functional tests (skip unit tests):

    podman kill ci_native_asan || true && RUN_UNIT_TESTS=false TEST_RUNNER_EXTRA="p2p_blockfilters" MAKEJOBS="-j$(nproc)" FILE_ENV="./ci/test/00_setup_env_native_asan.sh" ./ci/test_run_all.sh
    

    With result:

    Ran 11 tests in 2.543s
    
    OK
    Running Unit Tests for Test Framework Modules
    Remaining jobs: [p2p_blockfilters.py]
    1/1 - p2p_blockfilters.py failed, Duration: 2 s
    
    stdout:
    2023-05-16T09:23:21.794000Z TestFramework (INFO): PRNG seed is: 5743461567751360021
    2023-05-16T09:23:21.795000Z TestFramework (INFO): Initializing test directory /root/b-c-ci/ci/scratch/test_runner/test_runner_₿_🏃_20230516_092319/p2p_blockfilters_0
    2023-05-16T09:23:23.801000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 560, in start_nodes
        node.wait_for_rpc_connection()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 231, in wait_for_rpc_connection
        raise FailedToStartError(self._node_msg(
    test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 131, in main
        self.setup()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 298, in setup
        self.setup_network()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 392, in setup_network
        self.setup_nodes()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 414, in setup_nodes
        self.start_nodes()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 563, in start_nodes
        self.stop_nodes()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 578, in stop_nodes
        node.stop_node(wait=wait, wait_until_stopped=False)
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 342, in stop_node
        self.stop(wait=wait)
        ^^^^^^^^^
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 190, in __getattr__
        assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
                                      ^^^^^^^^^^^^^^^^^^^^
    AssertionError: [node 0] Error: no RPC connection
    2023-05-16T09:23:23.854000Z TestFramework (INFO): Stopping nodes
    [node 1] Cleaning up leftover process
    [node 0] Cleaning up leftover process
    
    
    stderr:
    Traceback (most recent call last):
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/p2p_blockfilters.py", line 274, in <module>
        CompactFiltersTest().main()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 155, in main
        exit_code = self.shutdown()
                    ^^^^^^^^^^^^^^^
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 314, in shutdown
        self.stop_nodes()
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 578, in stop_nodes
        node.stop_node(wait=wait, wait_until_stopped=False)
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 342, in stop_node
        self.stop(wait=wait)
        ^^^^^^^^^
      File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 190, in __getattr__
        assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
                                      ^^^^^^^^^^^^^^^^^^^^
    AssertionError: [node 0] Error: no RPC connection
    
    
    Combine the logs and print the last 99999999 lines ...
    
    ============
    Combined log for /root/b-c-ci/ci/scratch/test_runner//test_runner_₿_🏃_20230516_092319/p2p_blockfilters_0:
    ============
    
     test  2023-05-16T09:23:21.794000Z TestFramework (INFO): PRNG seed is: 5743461567751360021
     test  2023-05-16T09:23:21.794000Z TestFramework (DEBUG): Setting up network thread
     test  2023-05-16T09:23:21.795000Z TestFramework (INFO): Initializing test directory /root/b-c-ci/ci/scratch/test_runner/test_runner_₿_🏃_20230516_092319/p2p_blockfilters_0
     test  2023-05-16T09:23:21.797000Z TestFramework.node0 (DEBUG): bitcoind started, waiting for RPC to come up
     test  2023-05-16T09:23:21.797000Z TestFramework.node1 (DEBUG): bitcoind started, waiting for RPC to come up
     test  2023-05-16T09:23:23.801000Z TestFramework.node0 (DEBUG): Stopping node
     test  2023-05-16T09:23:23.801000Z TestFramework (ERROR): Assertion failed
                                       Traceback (most recent call last):
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 560, in start_nodes
                                           node.wait_for_rpc_connection()
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 231, in wait_for_rpc_connection
                                           raise FailedToStartError(self._node_msg(
                                       test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization
                                       During handling of the above exception, another exception occurred:
                                       Traceback (most recent call last):
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 131, in main
                                           self.setup()
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 298, in setup
                                           self.setup_network()
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 392, in setup_network
                                           self.setup_nodes()
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 414, in setup_nodes
                                           self.start_nodes()
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 563, in start_nodes
                                           self.stop_nodes()
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_framework.py", line 578, in stop_nodes
                                           node.stop_node(wait=wait, wait_until_stopped=False)
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 342, in stop_node
                                           self.stop(wait=wait)
                                           ^^^^^^^^^
                                         File "/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/test/functional/test_framework/test_node.py", line 190, in __getattr__
                                           assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
                                                                         ^^^^^^^^^^^^^^^^^^^^
                                       AssertionError: [node 0] Error: no RPC connection
     test  2023-05-16T09:23:23.804000Z TestFramework (DEBUG): Closing down network thread
     test  2023-05-16T09:23:23.854000Z TestFramework (INFO): Stopping nodes
     test  2023-05-16T09:23:23.855000Z TestFramework.node0 (DEBUG): Stopping node
    
     node0 stderr init.cpp:895:25: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
        [#0](/bitcoin-bitcoin/0/) 0xaaaac678ca58 in AppInitParameterInteraction(ArgsManager const&, bool) src/init.cpp:895:25
        [#1](/bitcoin-bitcoin/1/) 0xaaaac6758c44 in AppInit(node::NodeContext&, int, char**) src/bitcoind.cpp:176:14
        [#2](/bitcoin-bitcoin/2/) 0xaaaac6758c44 in main src/bitcoind.cpp:267:13
        [#3](/bitcoin-bitcoin/3/) 0xffff96676dbc  (/lib/aarch64-linux-gnu/libc.so.6+0x26dbc) (BuildId: 9efe43e32e614cad22a180ef036eea6154eafdc2)
        [#4](/bitcoin-bitcoin/4/) 0xffff96676e94 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x26e94) (BuildId: 9efe43e32e614cad22a180ef036eea6154eafdc2)
        [#5](/bitcoin-bitcoin/5/) 0xaaaac667f06c in _start (/root/b-c-ci/ci/scratch/build/bitcoin-aarch64-unknown-linux-gnu/src/bitcoind+0x98f06c) (BuildId: 5e23ce6e2e3afe05858f3446a0371be08b6d268a)
    
    SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change init.cpp:895:25 in
    
    TEST                | STATUS    | DURATION
    
    p2p_blockfilters.py | ✖ Failed  | 2 s
    
    ALL                 | ✖ Failed  | 2 s (accumulated) 
    Runtime: 2 s
    
    
  8. hebasto approved
  9. hebasto commented at 1:37 PM on May 16, 2023: member

    ACK fad09b703f5c6d8524a09eef771eb4525f9f3225, tested on Ubuntu 22.04: I can still see warnings from the sanitizers in both unit and functional tests.

  10. fanquake merged this on May 16, 2023
  11. fanquake closed this on May 16, 2023

  12. maflcko deleted the branch on May 16, 2023
  13. sidhujag referenced this in commit 40e595df17 on May 17, 2023
  14. fanquake referenced this in commit b8b0d64765 on Mar 27, 2024
  15. bitcoin locked this on May 15, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 09:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me