[erlang-questions] running tests with ct_run (cross target environment)

Devin Butterfield <>
Fri Oct 25 17:53:36 CEST 2013


Hi Lukas,

Yes now I see -- I was looking in ctlog when I should have looked in the
init_per_suite log. Adding -pa <path to test_server> definitely fixes this
issue.

Thank you for your help!
--
Regards, Devin


On Thu, Oct 24, 2013 at 2:47 PM, Lukas Larsson <> wrote:

> Hello Devin,
>
> The recommended way to run the Erlang/OTP tests is to use ts as described
> in the testing howto[1].
>
> If you want to do the testing with ct_run or erlexec you have to setup
> some of the environment manually.
>
> In your case the Erlang VM cannot find the module ts_install_cth. This is
> a Common Test Hook needed by most OTP test suites to run. In the
> init_per_suite log you should have seen something like this:
>
> *** CT 2013-10-24 23:42:25.116 *** Suite Hook
> Failed to start a CTH: error:{undef,
>                                  [{ts_install_cth,init,
>                                       [#Ref<0.0.0.1380>,[]],
>                                       []},
>                                   {ct_hooks,call_init,3,
>                                       [{file,"ct_hooks.erl"},{line,147}]},
>                                   {ct_hooks,call,4,
>                                       [{file,"ct_hooks.erl"},{line,222}]},
>                                   {ct_hooks,call,4,
>                                       [{file,"ct_hooks.erl"},{line,209}]},
>                                   {ct_hooks,call,3,
>                                       [{file,"ct_hooks.erl"},{line,183}]},
>                                   {ct_framework,ct_suite_init,3,
>
> [{file,"ct_framework.erl"},{line,262}]},
>                                   {test_server_sup,framework_call,4,
>                                       [{file,"test_server_sup.erl"},
>                                        {line,511}]},
>                                   {test_server,run_test_case_eval,9,
>                                       [{file,"test_server.erl"},
>                                        {line,1120}]}]}
>
> To make ct_run find that module you just have to add it to the path:
>
> ct_run -pa /opt/myrel/tests/test_server/ -no_auto_compile -suite
> ../emulator_test/float_SUITE
>
> Lukas
>
>
> On Thu, Oct 24, 2013 at 6:55 PM, Devin Butterfield <
> > wrote:
>
>> Hi,
>>
>> I am porting OTP to an embedded platform and trying to run standard OTP
>> tests on target. I am new to erlang, so apologies is this a FAQ, though I
>> have not found any explanation on the web. I've tried running directly
>> using ct_run and also erlexec, but the results are the same: "Error
>> detected: "Failed to start CTH, see the CT Log for details"". Looking at
>> the log reveal *no* details about this failure. What am I missing? See
>> below for output...
>>
>> Thanks!
>> --
>> Regards, Devin
>>
>> Using erlexec command:
>>
>> ######################
>> # using erlexec
>> ######################
>>
>> root:/opt/myrel/tests/test_server> erlexec -sname test_server -rsh rsh
>> -env PATH
>> "/opt/myrel/tests/emulator_test:/sbin:/usr/sbin:/bin:/usr/bin:/opt/myrel/bin:/opt/myrel/erts-5.10.3/bin"
>> -boot start_sasl -sasl errlog_type error -pz "/opt/
>> myrel/tests/test_server" -ct_test_vars "{net_dir,\"\"}" -eval
>> "ts_run:ct_run_test(\"/opt/myrel/tests/emulator_test\",
>> [{suite,float_SUITE},{logdir,\"../test_server\"},{auto_compile,
>> false},{config,[\"../test_server/ts.config\",\"../test_server/ts.unix.config\"]},{vars,[{verbose,0}]},batch,{scale_timetraps,true}])"
>> -noinput -s erlang halt
>>
>> Common Test starting (cwd is /opt/myrel/tests/emulator_test)
>>
>> CWD set to:
>> "/opt/myrel/tests/test_server/
>> "
>>
>> TEST INFO: 1 test(s), 12 case(s) in 1 suite(s)
>>
>> Testing tests.emulator_test.float_SUITE: Starting test, 12 test cases
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - -
>> Error detected: "Failed to start CTH, see the CT Log for details"
>> - - - - - - - - - - - - - - - - - - - - - - - - - -
>>
>> Testing tests.emulator_test.float_SUITE: *** FAILED *** init_per_suite
>> Testing tests.emulator_test.float_SUITE: TEST COMPLETE, 0 ok, 0 failed,
>> 12 skipped of 12 test cases
>>
>>
>> Crash dump was written to: erl_crash.dump
>>
>>
>> ###################
>> # USING c_run
>> ###################
>>
>>
>> root:/opt/myrel/tests/test_server> ct_run -no_auto_compile -suite
>> ../emulator_test/float_SUITE
>>
>> =PROGRESS REPORT==== 24-Mar-2035::03:29:17 ===
>>           supervisor: {local,sasl_safe_sup}
>>              started: [{pid,<0.40.0>},
>>                        {name,alarm_handler},
>>                        {mfargs,{alarm_handler,start_link,[]}},
>>                        {restart_type,permanent},
>>                        {shutdown,2000},
>>                        {child_type,worker}]
>>
>> =PROGRESS REPORT==== 24-Mar-2035::03:29:18 ===
>>           supervisor: {local,sasl_safe_sup}
>>              started: [{pid,<0.41.0>},
>>                        {name,overload},
>>                        {mfargs,{overload,start_link,[]}},
>>                        {restart_type,permanent},
>>                        {shutdown,2000},
>>                        {child_type,worker}]
>>
>> =PROGRESS REPORT==== 24-Mar-2035::03:29:18 ===
>>           supervisor: {local,sasl_sup}
>>              started: [{pid,<0.39.0>},
>>                        {name,sasl_safe_sup},
>>                        {mfargs,
>>                            {supervisor,start_link,
>>                                [{local,sasl_safe_sup},sasl,safe]}},
>>                        {restart_type,permanent},
>>                        {shutdown,infinity},
>>                        {child_type,supervisor}]
>>
>> =PROGRESS REPORT==== 24-Mar-2035::03:29:18 ===
>>           supervisor: {local,sasl_sup}
>>              started: [{pid,<0.42.0>},
>>                        {name,release_handler},
>>                        {mfargs,{release_handler,start_link,[]}},
>>                        {restart_type,permanent},
>>                        {shutdown,2000},
>>                        {child_type,worker}]
>>
>> =PROGRESS REPORT==== 24-Mar-2035::03:29:18 ===
>>          application: sasl
>>           started_at: 
>>
>>
>> Common Test v1.7.3 starting (cwd is /opt/myrel/tests/test_server)
>>
>> Eshell V5.10.3  (abort with ^G)
>> ()1>
>> ()1>
>> CWD set to:
>> "/opt/myrel/tests/test_server/"
>> ()1>
>> TEST INFO: 1 test(s), 12 case(s) in 1 suite(s)
>>
>> ()1> Testing tests.emulator_test.float_SUITE: Starting test,
>> 12 test cases
>> ()1>
>> - - - - - - - - - - - - - - - - - - - - - - - - - -
>> Error detected: "Failed to start CTH, see the CT Log for details"
>> - - - - - - - - - - - - - - - - - - - - - - - - - -
>>
>> ()1> Testing tests.emulator_test.float_SUITE: *** FAILED ***
>> init_per_suite
>> ()1> Testing tests.emulator_test.float_SUITE: TEST COMPLETE,
>> 0 ok, 0 failed, 12 skipped of 12 test cases
>>
>> ()1>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131025/1ab7f671/attachment.html>


More information about the erlang-questions mailing list