Skip to content

Conversation

@jchristgit
Copy link
Contributor

These commits update the common_test test suite to:

  • Remove usage of the deprecated ct_slave and slave modules in tests (with the exception of the ct_slave tests itself, and some test_server tests for test_server:start_node)
  • Switch ct:pal to ct:log in most top-level test suites (except for ct_log_SUITE, which explicitly wants to test them), since the stdout of peer nodes won't be shown on the main test nodes & IMO make sense to contain to the HTML logs
  • Enable the cte_track event handler in tests for both local and GitHub-based runs

The second and third commit are of course a bit opinionated, so I'm happy to drop them (and possibly make peer log to our stdout) if wanted.

The only change here I'm a bit unsure about is the `cth_auto_clean`
suite, it is unclear to me why the application master is not started in
`init_per_suite` already, as I can't find any call to start an app
inbetween.
Since peer is way less talkative on the console, trim the remaining logs
too, such that we can use e.g. `cte_track` for clean console output.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2025

CT Test Results

  2 files   57 suites   1h 11m 33s ⏱️
450 tests 435 ✅ 15 💤 0 ❌
484 runs  466 ✅ 18 💤 0 ❌

Results for commit 21c6109.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@rickard-green rickard-green added the team:PS Assigned to OTP team PS label Mar 10, 2025
@u3s
Copy link
Contributor

u3s commented Apr 2, 2025

I tried configuring cte_track for common_test once or twice, never finished. thanks for making an attempt!
There is some funny output in common_test test output requiring more attention but this could be tackled later.

@@ -1,2 +1,3 @@
{suites,"../common_test_test",all}.
{skip_suites,"../common_test_test",[ct_release_test_SUITE],"Versions not always correct"}.
{event_handler, {cte_track, []}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{enable_builtin_hooks, false}. addition is not needed? no logger events messing the output?
maybe they're generated less frequently for common_test suites ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I made a local test run with -enable_builtin_hooks false but it didn't look like it make much of a difference. Some logs (e.g. ct:pal tests) run on the main node and thus always end up on the terminal. I've added it regardless in case I missed something^^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. maybe it is not relevant for ct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to remove the addition again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're adding this enable_builtin_hoost, shouldn't we also add it to common_test.spec as well?

@jchristgit
Copy link
Contributor Author

There is some funny output in common_test test output requiring more attention but this could be tackled later.

do you mean the .. sequence of numbers? I saw that too, maybe we could move that into a peer-ed test at some point so it's hushed.

@u3s
Copy link
Contributor

u3s commented Apr 3, 2025

There is some funny output in common_test test output requiring more attention but this could be tackled later.

do you mean the .. sequence of numbers? I saw that too, maybe we could move that into a peer-ed test at some point so it's hushed.

I mean all leftovers, after changing pal->log and taking logger events out.
IIRC, there used to be some printouts when slave node was started ... maybe gone already with peer used.

@jchristgit
Copy link
Contributor Author

IIRC, there used to be some printouts when slave node was started ... maybe gone already with peer used.

I think those are mostly gone with peer, yeah: https://github.com/erlang/otp/actions/runs/14226758185/job/39868469457

I can check this out with a closer look next week, but I think the proper fix for that is to just run the tests that test ct:pal in a peer node where the output is captured.

@jchristgit
Copy link
Contributor Author

Hi @u3s, I pushed a new commit that hushes most of the remaining tests. cth_pre_post_test_io_SUITE is still noisy, I haven't figured out how to quiet it down - the cth_ctrl module of the suite data calls to error_logger and for some reason that ends up on stdout despite that running in a peered node.
Have a nice long weekend :-)

Comment on lines 33 to 34
%-include_lib("common_test/include/ct.hrl").
%-include_lib("common_test/include/ct_event.hrl").
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls remove if not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the amended last commit

end_per_testcase(_TestCase, _Config) ->
ok.
end_per_testcase(TestCase, Config) ->
ct_test_support:init_per_testcase(TestCase, Config).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why end_per_testcase is not called ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copypaste got me :-) This is fixed now.

@Mikaka27 Mikaka27 requested a review from Copilot July 23, 2025 12:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes usage of the deprecated ct_slave and slave modules in the common_test test suite, replacing them with the peer module. It also switches from ct:pal to ct:log in most test output to better handle peer node logging and enables the cte_track event handler in test specifications.

Key changes:

  • Replace slave:start() and ct_slave:start() calls with peer:start()
  • Update test code to handle peer controller processes for node management
  • Switch from ct:pal to ct:log for test output logging

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test_server_test_lib.erl Updates slave node startup to use peer module with controller process handling
ct_test_support.erl Major refactoring to replace slave module with peer for CT node management
erl2html2_SUITE.erl Switches to ct:log and adapts to use remote node for module info calls
ct_verbosity_SUITE.erl Updates node management to use peer controllers
Multiple test suites Switch from ct:pal to ct:log for consistent logging behavior
ct_cover_SUITE_data/cover_SUITE.erl Updates slave node management to use peer with proper cover handling
Comments suppressed due to low confidence (1)

lib/common_test/test/ct_cover_SUITE_data/cover_SUITE.erl:176

  • [nitpick] The variable name 'StartPeer' is confusing as it contains the return value of peer:start, not a function reference. Consider renaming to 'PeerResult' or 'StartResult'.
    {ok, _Controller, Node} = StartPeer = erpc:call(FromNode, peer, start, [PeerOpts]),

@@ -160,10 +165,19 @@ start_slave(Name) ->
start_slave(node(),Name).

start_slave(FromNode,Name) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename those functions to also not include the word 'slave' while we're at it?

Comment on lines 88 to 89
slave(cleanup,_Config) ->
kill_slaves([nodename(slave,1)]).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename those functions to also not include the word 'slave' while we're at it?

start_peer(Name, Args) ->
{ok, Host} = inet:gethostname(),
?CT_PEER(#{host => Host, name => Name,
args => Args, timeout => timer:seconds(10)}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the option timeout coming from to ?CT_PEER? I only see wait_boot here: https://www.erlang.org/docs/28/apps/stdlib/peer.html#t:start_options/0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet it was meant to be wait_boot (which, in the hindsight, I should've named timeout, but it's too late for that now).

host => Host,
name => Name,
% extending some timers for slow test hosts
timeout => timer:seconds(15),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the option timeout coming from to ?CT_PEER? I only see wait_boot here: https://www.erlang.org/docs/28/apps/stdlib/peer.html#t:start_options/0

{init_timeout,15},
{startup_timeout,15}]),

{ok, Controller, Node} = ?CT_PEER(#{name => ct_nomerge, timeout => timer:seconds(15)}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the option timeout coming from to ?CT_PEER? I only see wait_boot here: https://www.erlang.org/docs/28/apps/stdlib/peer.html#t:start_options/0

{init_timeout,15},
{startup_timeout,15}]),

{ok, Controller, Node} = ?CT_PEER(#{name => ct_nomerge, timeout => timer:seconds(15)}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the option timeout coming from to ?CT_PEER? I only see wait_boot here: https://www.erlang.org/docs/28/apps/stdlib/peer.html#t:start_options/0

{ok,Node} = ct_slave:start(nc_remote_crash,[{boot_timeout,15},
{init_timeout,15},
{startup_timeout,15}]),
{ok, _Controller, Node} = ?CT_PEER(#{name => nc_remote_crash, timeout => timer:seconds(15)}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the option timeout coming from to ?CT_PEER? I only see wait_boot here: https://www.erlang.org/docs/28/apps/stdlib/peer.html#t:start_options/0

join_abs_dirs/2]).

-export([start_slave/3, slave_stop/1]).
-export([start_slave/3, slave_stop/2]).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename functions in this module to not use 'slave'?

@Mikaka27 Mikaka27 added the waiting waiting for changes/input from author label Aug 4, 2025
@dgud dgud requested a review from kvakvs August 5, 2025 12:08
@IngelaAndin IngelaAndin assigned kvakvs and unassigned Mikaka27 Sep 1, 2025
@IngelaAndin IngelaAndin removed the request for review from kvakvs February 2, 2026 11:53
@IngelaAndin IngelaAndin assigned OTP-Maintainer and unassigned kvakvs Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium team:PS Assigned to OTP team PS waiting waiting for changes/input from author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants