Quantcast

common test hiding errors?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

common test hiding errors?

Joel Reymont
I'm using Common Test for OpenPoker integration tests.

I just discovered that I'm calling a function that is not exported from a module.

I only discovered this by inserting copious printouts into my code to figure out what part was crashing.

Why and where did Common Test hide the 'undef'?

It's nowhere to be found!

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Wes James
On Tue, Aug 9, 2011 at 3:50 PM, Joel Reymont <[hidden email]> wrote:
> I'm using Common Test for OpenPoker integration tests.
>
> I just discovered that I'm calling a function that is not exported from a module.
>
> I only discovered this by inserting copious printouts into my code to figure out what part was crashing.
>
> Why and where did Common Test hide the 'undef'?
>
> It's nowhere to be found!


find . -name "*.erl" -exec grep undef {} \; -print

might help....

-wes
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Joel Reymont

On Aug 9, 2011, at 11:01 PM, Wes James wrote:

> find . -name "*.erl" -exec grep undef {} \; -print


How exactly will searching for undef in my code help?

The problem is not particular to undef, actually.

I just exported the function and it crashes on something else but I still don't see the crash report.

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Joel Reymont
In reply to this post by Wes James
The following is what I see in logs/raw.log.

I know the game has crashed because the players are leaving and because showdown:winners did not return.

    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    sitgo.erl:60 <0.258.0> hands ranked(<0.258.0>) call showdown:winners([{hand,<0.259.0>,1,[259,771],0,10,none,0}],[{0,[]}])
   
    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    observer.erl:201 <0.275.0> Game 1: LEAVE -> 5
    (<0.258.0>) call showdown:winners([{hand,<0.259.0>,1,[259,771],0,10,none,0}],[{0,[]}],[])
    (<0.258.0>) call showdown:'-winners/3-fun-0-'({hand,<0.259.0>,1,[259,771],0,10,none,0},[])
   
    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    observer.erl:201 <0.275.0> Game 1: LEAVE -> 4
   
    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    observer.erl:201 <0.275.0> Game 1: LEAVE -> 3

Invoking showdown:winners at the Erlang prompt gives me an error.

    Eshell V5.8.4  (abort with ^G)
    1> showdown:winners([{hand,self(),1,[259,771],0,10,none,0}],[{0,[]}]).  
    ** exception error: no function clause matching
                        gb_trees:is_defined(<0.31.0>,[])
         in function  lists:'-filter/2-lc$^0/1-0-'/2
         in call from showdown:winners/3

How do I make Common Test show me this error during testing?

        Thanks, Joel

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Loïc Hoguin
On 08/10/2011 12:07 AM, Joel Reymont wrote:

> The following is what I see in logs/raw.log.
>
> I know the game has crashed because the players are leaving and because showdown:winners did not return.
>
>     =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
>     sitgo.erl:60 <0.258.0> hands ranked(<0.258.0>) call showdown:winners([{hand,<0.259.0>,1,[259,771],0,10,none,0}],[{0,[]}])
>    
>     =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
>     observer.erl:201 <0.275.0> Game 1: LEAVE -> 5
>     (<0.258.0>) call showdown:winners([{hand,<0.259.0>,1,[259,771],0,10,none,0}],[{0,[]}],[])
>     (<0.258.0>) call showdown:'-winners/3-fun-0-'({hand,<0.259.0>,1,[259,771],0,10,none,0},[])
>    
>     =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
>     observer.erl:201 <0.275.0> Game 1: LEAVE -> 4
>    
>     =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
>     observer.erl:201 <0.275.0> Game 1: LEAVE -> 3
>
> Invoking showdown:winners at the Erlang prompt gives me an error.
>
>     Eshell V5.8.4  (abort with ^G)
>     1> showdown:winners([{hand,self(),1,[259,771],0,10,none,0}],[{0,[]}]).  
>     ** exception error: no function clause matching
>                         gb_trees:is_defined(<0.31.0>,[])
>          in function  lists:'-filter/2-lc$^0/1-0-'/2
>          in call from showdown:winners/3
>
> How do I make Common Test show me this error during testing?

Are you catching the exception perhaps? The error message you get seems
custom so I'm guessing your code catches the exception and then prints
the error message ct gives you. So the test doesn't crash and ct doesn't
know about that error.

--
Loïc Hoguin
Dev:Extend
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Lukas Larsson-4
In reply to this post by Joel Reymont
Hello!

Common Test detects any crashes which happen in the same process as the testcase is run in. If a crash happens in another process, it will not be detected unless you in your testcase check whether said process is alive or is linked to it. Could this be what is going wrong?

If you're still having difficulties, could you post a minimal example of what you are trying to do? It's difficult to guess what could be the problem without an example to look at.

Also if you want to have the SASL and error_logger output in your common test logs instead of redirecting them to a local file you might want to use the cth_log_redirect hook found here https://github.com/garazdawi/cth_tools.

Lukas

----- Original Message -----
From: "Joel Reymont" <[hidden email]>
To: "erlang-questions" <[hidden email]>
Sent: Wednesday, 10 August, 2011 12:07:56 AM
Subject: Re: [erlang-questions] common test hiding errors?

The following is what I see in logs/raw.log.

I know the game has crashed because the players are leaving and because showdown:winners did not return.

    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    sitgo.erl:60 <0.258.0> hands ranked(<0.258.0>) call showdown:winners([{hand,<0.259.0>,1,[259,771],0,10,none,0}],[{0,[]}])
   
    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    observer.erl:201 <0.275.0> Game 1: LEAVE -> 5
    (<0.258.0>) call showdown:winners([{hand,<0.259.0>,1,[259,771],0,10,none,0}],[{0,[]}],[])
    (<0.258.0>) call showdown:'-winners/3-fun-0-'({hand,<0.259.0>,1,[259,771],0,10,none,0},[])
   
    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    observer.erl:201 <0.275.0> Game 1: LEAVE -> 4
   
    =ERROR REPORT==== 9-Aug-2011::22:59:35 ===
    observer.erl:201 <0.275.0> Game 1: LEAVE -> 3

Invoking showdown:winners at the Erlang prompt gives me an error.

    Eshell V5.8.4  (abort with ^G)
    1> showdown:winners([{hand,self(),1,[259,771],0,10,none,0}],[{0,[]}]).  
    ** exception error: no function clause matching
                        gb_trees:is_defined(<0.31.0>,[])
         in function  lists:'-filter/2-lc$^0/1-0-'/2
         in call from showdown:winners/3

How do I make Common Test show me this error during testing?

        Thanks, Joel

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Joel Reymont
In reply to this post by Loïc Hoguin

On Aug 10, 2011, at 9:04 AM, Loïc Hoguin wrote:

> Are you catching the exception perhaps?

No.

> The error message you get seems
> custom so I'm guessing your code catches the exception and then prints
> the error message ct gives you. So the test doesn't crash and ct doesn't
> know about that error.


I don't get any errors, that's the point.

The custom error message is from running at the Erlang prompt, the rest are debug printouts.

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: common test hiding errors?

Joel Reymont
In reply to this post by Lukas Larsson-4

On Aug 10, 2011, at 9:09 AM, Lukas Larsson wrote:

> Common Test detects any crashes which happen in the same process as the testcase is run in. If a crash happens in another process, it will not be detected unless you in your testcase check whether said process is alive or is linked to it. Could this be what is going wrong?

Yes, that's what's going on. I'm cannot link to all the processes in the "system under testing", I think that's unrealistic.

I do expect to be told when something goes wrong, though, get a printout in the log, etc.

This is in line with what EUnit does, for example.

> If you're still having difficulties, could you post a minimal example of what you are trying to do? It's difficult to guess what could be the problem without an example to look at.

It's another process that's crashes.

> Also if you want to have the SASL and error_logger output in your common test logs instead of redirecting them to a local file you might want to use the cth_log_redirect hook found here https://github.com/garazdawi/cth_tools.


I'm perfectly fine with redirecting error_logger output to a local file but it seems that it shows up just fine in the CT logs.

What's not showing up is error messages from other processes crashing, a completely unintuitive behavior, I think.

        Thanks, Joel

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...