[erlang-bugs] common_test + test_server_io errors

Peter Andersson peppe@REDACTED
Fri Aug 23 17:43:35 CEST 2013


Hi Tim,

Ok, I have something for you now that will hopefully work. Please test
it as soon as you can and get back to me!

I've modified both Common Test and Test Server and you'll find the
changes in this branch:

  git://github.com/peppe-erlang/otp.git peppe/common_test/cth_ctrl

The idea now is that you start Common Test using a hook like the example
module I've attached (cth_ctrl), e.g:

  ct_run -pa $PWD -logdir ./logs -ct_hooks cth_ctrl -suite dummy_SUITE.erl

This "pauses" Common Test immediately after startup, in the hook init
function, and logging is enabled at that point (which didn't work
before). The example hook spawns a process that calls ct:pal/2 and
error_logger:error_report/1 in a loop to verify this. When you're done
with your startup operations, you call a proceed function to start the
test run. When the tests are done you get paused again, this time in the
hook terminate function, with logging still enabled. When your teardown
operations are finished, you call the proceed function again and Common
Test terminates.

Here's how logging works (which I mean to document properly in the
User's Guide before the upcoming release): All printouts with ct:log/2
or ct:pal/2, or any error/progress reports that happen in the pre-test
phase are saved in a log file which you find a link to on the CT
Framework Log page. Similarly, all printouts/reports that happen in the
post-test phase, are saved in the same log file, and you get a link to
this section also on the CT Framework Log page.

When tests run, printouts and reports are saved as usual in the test
case log files, or in the Unexpected I/O Log (for any printouts that
can't be associated to a particular test case).

I hope this solution works for you. Please get back to me with comments
and questions!

Best regards,
Peter

Ericsson AB, Erlang/OTP


Tim Watson wrote:
> Hi Peter,
>
> Ok that's great - thanks for your assistance!
>
> Cheers,
> Tim
>
>
>
> On 14 August 2013 12:36, Peter Andersson
> <peter.e.andersson@REDACTED
> <mailto:peter.e.andersson@REDACTED>> wrote:
>
>
>     Hi Tim,
>
>     Thanks for all the useful info!
>
>     I haven't actually run any tests on this myself, only read some
>     code so far. Obviously the init and terminate hook functions get
>     called before the test server process is even started. In other
>     words, these functions actually execute in that short "evil"
>     window during startup when you can't call pal/2 or log/2. I missed
>     that. :-( Sorry for misleading you!
>
>     Let me dig into this properly and get back to you when I can
>     propose useful (tested!) solutions to your problems!
>
>     Best,
>     Peter
>
>     Ericsson AB, Erlang/OTP
>
>
>
>     On Wed, 14 Aug 2013, Tim Watson wrote:
>
>         On 14 August 2013 12:09, Tim Watson <watson.timothy@REDACTED
>         <mailto:watson.timothy@REDACTED>> wrote:
>
>             When I execute a test run with this code in place however,
>             I still get the
>             crash, though the io:format/2 notice that I'm starting the
>             ct log appears
>             first:
>
>             Common Test starting (cwd is
>             /home/t4/work/vmware/rabbitmq-public-umbrella/rabbitmq-test/multi-node)
>
>             starting ct log!
>
>
>             ct_util_server got EXIT from <0.61.0>: {noproc,
>                                                     {gen_server,call,
>                                                      [test_server_io,
>                                                      
>             {print,xxxFrom,unexpected_io,
>                                                        [[[["<div
>             class=\"default\"><b>*** User 2013-08-14 12:02:36.830
>             ***</b>"],
>
>                                                           "\n",
>
>             [91,102,114,97,109,101,119,111,
>                                                          
>              114,107,93,32,119,97,116,99,
>
>             104,100,111,103,58,32,110,111,
>
>             32,112,114,111,99,115,32,116,
>
>             111,32,107,105,108,108,"\n"]],
>                                                          "\n","</div>"]]},
>                                                       infinity]}}
>
>
>             So it appears that the assertion that logging will work
>             between the hook's
>             init and terminate callbacks isn't quite working.
>
>
>         Oh and I've tried pausing between the systest_ct_log:start/0
>         call and the
>         (latter) systest:reset/0 call that triggers the logging, but
>         that didn't
>         make any difference either - e.g., like so:
>
>         init(systest, Opts) ->
>            case application:start(systest, permanent) of
>                {error, {already_started, systest}} ->
>         io:format("starting ct
>         log!~n"),
>                                                      
>         systest_ct_log:start(),
>                                                       receive
>                                                           foobar -> ok
>                                                       after 2000 -> ok
>                                                       end,
>                                                       systest:reset();
>                {error, _Reason}=Err                -> Err;
>                ok                                  -> ok
>            end,
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cth_ctrl.erl
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20130823/64749397/attachment.ksh>


More information about the erlang-bugs mailing list