ct_run(1)
π ct_run β it's in the ct_run(1) manual, Erlang Module Definition, and it's so good
okay bestie, sit down, hydrate π this is the program that starts Common Test straight from your OS command line. Not the Erlang shell. The actual terminal. iconic.
β¨ NAME β¨
ct_run β the program you use to start Common Test from the OS command line π
πΈ DESCRIPTION πΈ
So ct_run just... comes with the house. π It's automatically installed alongside Erlang/OTP and the Common Test application (for the full lore, check out the section Installation in the User's Guide). And it takes a whole bunch of different start flags:
- Some flags make
ct_runactually start Common Test and hand it your data π«Ά - Other flags just spin up an Erlang node prepped for running Common Test in a particular mode
ngl the interface function ct:run_test/1 is the twin flame of the ct_run program β that's the one you use to start Common Test from the Erlang shell (or from an Erlang program). Deets live in the ct manual page, iykyk.
Also?? ct_run accepts Erlang emulator flags too π It uses those when it calls erl to start the Erlang node. Which means you can add directories to the code server path, change the cookie on the node, start more applications, and so on. literally so much power.
π¦ the -erl_args situation (pay attention bestie)
With the optional flag -erl_args, everything on the ct_run command line gets split into two little groups:
- One group that Common Test is supposed to process β those are the ones preceding
-erl_argsπ - One group that Common Test ignores and passes straight to the emulator β those following
-erl_argsπ
And it gets better: options that precede -erl_args that Common Test doesn't even recognize? Those also get passed on to the emulator untouched. So with -erl_args you can literally have flags with the same name but different destinations on the same ct_run command line. main character behaviour fr fr.
π the -pa / -pz warning, no cap
If flags -pa or -pz are specified in the Common Test group of options (the ones preceding -erl_args), then relative directories get converted to absolute and reinserted into the code path by Common Test. Why? To avoid problems loading user modules when Common Test changes working directory during test runs π ty for your service.
BUT. However. Common Test ignores flags -pa and -pz that come following -erl_args on the command line. Those directories are added to the code path normally β that is, in the form specified. Don't get it twisted. π
π₯ exit status (the receipts)
Exit status is set before the program ends:
0β a successful test result β¨1β one or more failed or auto-skipped test cases π2β test execution failure π
And if you call ct_run with the option -help, it prints all valid start flags to stdout. a legend.
π Run Tests from Command Line
ct_run -dir TestDir1 TestDir2 .. TestDirN |
[-dir TestDir] -suite Suite1 Suite2 .. SuiteN
[-group Groups1 Groups2 .. GroupsN] [-case Case1 Case2 .. CaseN]
[-step [config | keep_inactive]]
[-config ConfigFile1 ConfigFile2 .. ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. CallbackModuleN ConfigStringN]
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-label Label]
[-logdir LogDir]
[-logopts LogOpts]
[-verbosity GenVLevel | [Category1 VLevel1 and
Category2 VLevel2 and .. CategoryN VLevelN]]
[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]
[-stylesheet CSSFile]
[-cover CoverCfgFile]
[-cover_stop Bool]
[-event_handler EvHandler1 EvHandler2 .. EvHandlerN] |
[-event_handler_init EvHandler1 InitArg1 and
EvHandler2 InitArg2 and .. EvHandlerN InitArgN]
[-include InclDir1 InclDir2 .. InclDirN]
[-no_auto_compile]
[-abort_if_missing_suites]
[-multiply_timetraps Multiplier]
[-scale_timetraps]
[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]
[-repeat N] |
[-duration HHMMSS [-force_stop [skip_rest]]] |
[-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]
[-basic_html]
[-no_esc_chars]
[-keep_logs all | NLogs]
[-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and ..
CTHModuleN CTHOptsN]
[-ct_hooks_order test | config]
[-exit_status ignore_config]
[-help]
like. the sheer range. obsessed. π
π Run Tests using Test Specification
ct_run -spec TestSpec1 TestSpec2 .. TestSpecN
[-join_specs]
[-config ConfigFile1 ConfigFile2 .. ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. and CallbackModuleN ConfigStringN]
[-decrypt_key Key] | [-decrypt_file KeyFile]
[-label Label]
[-logdir LogDir]
[-logopts LogOpts]
[-verbosity GenVLevel | [Category1 VLevel1 and
Category2 VLevel2 and .. CategoryN VLevelN]]
[-allow_user_terms]
[-silent_connections [ConnType1 ConnType2 .. ConnTypeN]]
[-stylesheet CSSFile]
[-cover CoverCfgFile]
[-cover_stop Bool]
[-event_handler EvHandler1 EvHandler2 .. EvHandlerN] |
[-event_handler_init EvHandler1 InitArg1 and
EvHandler2 InitArg2 and .. EvHandlerN InitArgN]
[-include InclDir1 InclDir2 .. InclDirN]
[-no_auto_compile]
[-abort_if_missing_suites]
[-multiply_timetraps Multiplier]
[-scale_timetraps]
[-create_priv_dir auto_per_run | auto_per_tc | manual_per_tc]
[-repeat N] |
[-duration HHMMSS [-force_stop [skip_rest]]] |
[-until [YYMoMoDD]HHMMSS [-force_stop [skip_rest]]]
[-basic_html]
[-no_esc_chars]
[-keep_logs all | NLogs]
[-ct_hooks CTHModule1 CTHOpts1 and CTHModule2 CTHOpts2 and ..
CTHModuleN CTHOptsN]
[-ct_hooks_order test | config]
[-exit_status ignore_config]
π§ Refresh HTML Index Files
ct_run -refresh_logs [-logdir LogDir] [-basic_html]
[-keep_logs all | NLogs]
just a lil glow-up for your index files, that's it π
π«Ά Run Common Test in Interactive Mode
ct_run -shell
[-config ConfigFile1 ConfigFile2 ... ConfigFileN]
[-userconfig CallbackModule1 ConfigString1 and CallbackModule2
ConfigString2 and .. and CallbackModuleN ConfigStringN]
[-decrypt_key Key] | [-decrypt_file KeyFile]
living in the shell, as one does β¨
π Start a Common Test Master Node
ct_run -ctmaster
master node. master energy. periodt.
β See Also β
For the whole story about the start flags, go read the section Running Tests and Analyzing Results in the User's Guide π
friendly reminder bestie: copy those command lines exactly, don't freestyle the flags, and definitely don't forget which side of -erl_args you're on π
okay that's the whole page!! brought to you by Ericsson AB, and this lil masterpiece is common_test 1.31.1, from the ct_run(1) manual π slay, bye π¦
π¦ where this page comes from
- ubuntu stonking: erlang-common-test 1:29.0.6+dfsg-1 Β· Apache-2.0
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms