Skip to content

feat(ct_test): add auto_sname to opt out of -hidden -sname - #16

Open
TrapsterDK wants to merge 1 commit into
bazelverse:mainfrom
TrapsterDK:pr3
Open

TrapsterDK wants to merge 1 commit into
bazelverse:mainfrom
TrapsterDK:pr3

Conversation

@TrapsterDK

Copy link
Copy Markdown

Fixes #15.

Problem
ct_test always starts ct_run with -hidden -sname <name>. A named node needs epmd and a free name on a working loopback. In a sandbox without a loopback interface the node cannot start, and the test fails before any case runs. ct_run_extra_args can add node options but cannot remove these two.

Change

  • New bool attribute auto_sname on ct_test, default True.
  • When False, both the POSIX and the Windows script start ct_run without -hidden and -sname. ct_run_extra_args then chooses the node options. For example, -sname undefined -start_epmd false runs the suite without epmd.
  • Without any -sname or -name, ct_run uses its own default name (ct). The attribute doc says so.
  • ct_suite and ct_suite_variant pass it through **kwargs.
  • With the default, the generated scripts are byte-for-byte unchanged. This was checked by building the POSIX and the Windows script on main and on the branch and comparing them.

Test

  • private/ct_auto_sname_test: analysis tests on the generated POSIX and Windows scripts. -hidden and -sname are present by default and absent with auto_sname = False.
  • test/ct_no_sname: a suite with auto_sname = False and -sname undefined -start_epmd false. It checks that node() is nonode@nohost and that the node is not hidden. With the default auto_sname the same suite fails, because -hidden is still passed.

Note: test/ct_no_sname runs in every CI job; it was run here on Linux with OTP 29 only. I could not run the macOS or Windows jobs.

Test output (OTP 29.1.2, Bazel 9.2.0, --nohome_rc)

The PR was also checked alone on main (root bazel test //... passes). The output below is from all four of my PRs stacked (bazel test //... in the root, then in test/).

//:util_tests_test_0 (cached) PASSED in 0.0s
//private:app_file_test (cached) PASSED in 0.0s
//private:util_tests_test_0 (cached) PASSED in 0.0s
//private/ct_auto_sname_test:auto_sname_posix_test (cached) PASSED in 0.0s
//private/ct_auto_sname_test:auto_sname_windows_test (cached) PASSED in 0.0s
//private/ct_auto_sname_test:default_posix_test (cached) PASSED in 0.0s
//private/ct_auto_sname_test:no_sname_posix_test (cached) PASSED in 0.0s
//private/ct_auto_sname_test:no_sname_windows_test (cached) PASSED in 0.1s
//private/otp_tree_test:erl_eval_with_release_tar_test (cached) PASSED in 0.0s
//private/otp_tree_test:erl_eval_with_tree_test (cached) PASSED in 0.1s
//private/otp_tree_test:erl_runs_from_tree_test (cached) PASSED in 0.0s
//private/otp_tree_test:eunit_with_tree_test (cached) PASSED in 0.0s
//private/otp_tree_test:template_vars_with_tree_test (cached) PASSED in 0.0s
//private/xrl_yrl_test:lexer_installs_erlang_test (cached) PASSED in 0.1s
//private/xrl_yrl_test:parser_installs_erlang_test (cached) PASSED in 0.0s
Executed 0 out of 15 tests: 15 tests pass.
//app_file:test_applications_preserved PASSED in 0.1s
//ct_no_sname:no_sname_SUITE PASSED in 3.2s
//custom_vars:custom_var_test PASSED in 0.0s
//dot_app_to_json:dialyze PASSED in 0.9s
//dot_app_to_json:dot_app_to_json_SUITE PASSED in 3.2s
//dot_app_to_json:xref PASSED in 0.6s
//erl_attrs_to_json:dialyze PASSED in 0.9s
//erl_attrs_to_json:erl_attrs_to_json_SUITE PASSED in 3.5s
//erl_attrs_to_json:xref PASSED in 0.3s
//rebar_config_to_json:dialyze PASSED in 0.9s
//rebar_config_to_json:rebar_config_to_json_SUITE PASSED in 3.2s
//rebar_config_to_json:xref PASSED in 0.6s
//shard_suite:dialyze PASSED in 0.9s
//shard_suite:eunit PASSED in 0.5s
//shard_suite:shard_suite_SUITE PASSED in 3.6s
//shard_suite:xref PASSED in 0.6s
//xrl_yrl:xrl_yrl_test PASSED in 0.1s
Executed 17 out of 18 tests: 17 tests pass and 1 was skipped.

Assisted by Claude.

ct_test always starts ct_run with -hidden -sname <name>. A named node
needs epmd and a free name on a working loopback. In sandboxes without
a loopback interface the node cannot start, so the test fails before
any case runs. ct_run_extra_args can add node options but cannot
remove these two.

Add a bool attribute auto_sname to ct_test (default True). When False,
both the POSIX and the Windows script start ct_run without -hidden and
-sname, and ct_run_extra_args picks the node options. For example,
-sname undefined -start_epmd false runs the suite without epmd.
ct_suite and ct_suite_variant pass it through **kwargs. With the
default, the generated scripts are byte-for-byte unchanged.

Add analysis tests for the POSIX and Windows scripts with and without
the option, and a test/ suite that runs with auto_sname = False and
-sname undefined -start_epmd false and checks that the node is
unnamed and not hidden.

Assisted by Claude.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ct_test cannot run ct_run without -hidden -sname

1 participant