Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
unit testing a freeze
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dominik Haumann  
View profile  
 More options Mar 21 2012, 5:29 pm
From: Dominik Haumann <dhaum...@kde.org>
Date: Wed, 21 Mar 2012 22:29:53 +0100
Local: Wed, Mar 21 2012 5:29 pm
Subject: unit testing a freeze
Moin,

is there a simple way to unit test a freeze?
Like if the test needs more than 5 seconds, fail?

One way would be to create a thread, start the freeze unit test, and if the
thread does not finish in some time period, kill it and fail. But that's
rather complicated for such a simple thing. Maybe QTest already provides some
nice feature?

Thanks
Dominik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dario Freddi  
View profile  
 More options Mar 21 2012, 8:11 pm
From: Dario Freddi <drf54...@gmail.com>
Date: Thu, 22 Mar 2012 01:11:53 +0100
Local: Wed, Mar 21 2012 8:11 pm
Subject: Re: unit testing a freeze
Il 21 marzo 2012 22:29, Dominik Haumann <dhaum...@kde.org> ha scritto:

> Moin,

> is there a simple way to unit test a freeze?
> Like if the test needs more than 5 seconds, fail?

There's no straightforward way to check afaik and I don't really like
the thread approach. What are you trying to verify? If the context is
the one of a synchronous operation, I am afraid this might be very
tricky, since there is no easy way you can interrupt a synchronous
call identifying its context. Supposing your routine is asynchronous,

QTimer timer;
QEventLoop e;
connect(&timer, SIGNAL(timeout()), &e, SLOT(quit()));
connect(myObject, SIGNAL(finished()), &e, SLOT(quit()));
myObject->problematicAsyncCall();
timer.setSingleShot(true);
timer.start(5000);
e.exec();

QVERIFY(timer.isActive());

In case the freeze is on a synchronous operation, the only thing you
can do is crashing the unit test I am afraid. But again, you have a
number of problems with synchronization and stuff. Supposing your call
does not block Qt's event loop, you could for example create a timer
again which connects to a slot performing stuff like:

QVERIFY(false);
qApp->exit(1);

If the event loop is blocked, a thread is the only solution but I see
multiple shortcomings with that approach.

Hope this helped.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank Reininghaus  
View profile  
 More options Mar 22 2012, 2:00 am
From: Frank Reininghaus <frank7...@googlemail.com>
Date: Thu, 22 Mar 2012 07:00:42 +0100
Local: Thurs, Mar 22 2012 2:00 am
Subject: Re: unit testing a freeze
Hi,

Am 22. März 2012 01:11 schrieb Dario Freddi:

I think the same could be achieved like this:

myObject->problematicAsyncCall();
QTest::kWaitForSignal(myObject, SIGNAL(finished()), 5000)

Best regards,
Frank


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dario Freddi  
View profile  
 More options Mar 22 2012, 3:34 am
From: Dario Freddi <drf54...@gmail.com>
Date: Thu, 22 Mar 2012 08:34:22 +0100
Local: Thurs, Mar 22 2012 3:34 am
Subject: Re: unit testing a freeze
Il 22 marzo 2012 07:00, Frank Reininghaus <frank7...@googlemail.com> ha scritto:

Correct - I forgot we were using KDE's infrastructure and not pure Qt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dominik Haumann  
View profile  
 More options Mar 22 2012, 4:46 am
From: Dominik Haumann <dhaum...@kde.org>
Date: Thu, 22 Mar 2012 09:46:16 +0100
Local: Thurs, Mar 22 2012 4:46 am
Subject: Re: unit testing a freeze
On Thursday, March 22, 2012 01:11:53 Dario Freddi wrote:

> Il 21 marzo 2012 22:29, Dominik Haumann <dhaum...@kde.org> ha scritto:
> > Moin,

> > is there a simple way to unit test a freeze?
> > Like if the test needs more than 5 seconds, fail?

> There's no straightforward way to check afaik and I don't really like
> the thread approach. What are you trying to verify?

Kate: Switch to block selection, place cursor after end of line, press
ctrl+shift+left. This freezes Kate forever at 100% cpu.

We have a fix for that, but I want to add a unit test to prevent this from
happening again. It's not an asynchronous operation.

It would help if we could tell the the unit test launcher script that the test
should be killed if it did not finish within 5 seconds. But guess this is not
possible atm.

A thread is a problem as Kate Part is not thread safe. So if I call the
problematic function from a thread, the main thread may still process e.g.
paint events for the text view (the overall behavior is undefined). Probably,
processing events in the meantime can be suppressed.

I'll play around with what you suggested, maybe it can be done with a few
lines of code :)

Thanks
Dominik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Fiestas  
View profile  
 More options Mar 22 2012, 5:33 am
From: Alex Fiestas <afies...@kde.org>
Date: Thu, 22 Mar 2012 10:33:49 +0100
Local: Thurs, Mar 22 2012 5:33 am
Subject: Re: Re: unit testing a freeze
Execute the process with K/QProcess, then try to send a unix signal to it,
that might work as well though it depends on unix signals which are crappy.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Milian Wolff  
View profile  
 More options Mar 22 2012, 5:47 am
From: Milian Wolff <m...@milianw.de>
Date: Thu, 22 Mar 2012 10:47:18 +0100
Local: Thurs, Mar 22 2012 5:47 am
Subject: Re: unit testing a freeze

On Wednesday 21 March 2012 22:29:53 Dominik Haumann wrote:

> Moin,

> is there a simple way to unit test a freeze?
> Like if the test needs more than 5 seconds, fail?

> One way would be to create a thread, start the freeze unit test, and if the
> thread does not finish in some time period, kill it and fail. But that's
> rather complicated for such a simple thing. Maybe QTest already provides
> some nice feature?

Why not Zoidberg? Uhm I mean: ctest --timeout <seconds>

Cheers
--
Milian Wolff
m...@milianw.de
http://milianw.de

  signature.asc
< 1K Download


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Milian Wolff  
View profile  
 More options Mar 22 2012, 10:50 am
From: Milian Wolff <m...@milianw.de>
Date: Thu, 22 Mar 2012 15:50:34 +0100
Local: Thurs, Mar 22 2012 10:50 am
Subject: Re: unit testing a freeze

On Thursday 22 March 2012 11:08:35 Dominik Haumann wrote:

> On Thursday, March 22, 2012 10:47:18 Milian Wolff wrote:
> > Why not Zoidberg? Uhm I mean: ctest --timeout <seconds>

> That would do the trick. Is it possible to set this timeout for a single
> test in CMakeLists.txt?

yes:

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_test:TIMEOUT

Bye
--
Milian Wolff
m...@milianw.de
http://milianw.de

  signature.asc
< 1K Download


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dario Freddi  
View profile  
 More options Mar 22 2012, 11:59 am
From: Dario Freddi <drf54...@gmail.com>
Date: Thu, 22 Mar 2012 16:59:50 +0100
Local: Thurs, Mar 22 2012 11:59 am
Subject: Re: unit testing a freeze
Il 22 marzo 2012 15:50, Milian Wolff <m...@milianw.de> ha scritto:

> On Thursday 22 March 2012 11:08:35 Dominik Haumann wrote:
>> On Thursday, March 22, 2012 10:47:18 Milian Wolff wrote:
>> > Why not Zoidberg? Uhm I mean: ctest --timeout <seconds>

>> That would do the trick. Is it possible to set this timeout for a single
>> test in CMakeLists.txt?

> yes:

> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_test:TIMEOUT

Neat, didn't know about that, thanks

/me notes down


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dominik Haumann  
View profile  
 More options Mar 22 2012, 4:52 pm
From: Dominik Haumann <dhaum...@kde.org>
Date: Thu, 22 Mar 2012 21:52:56 +0100
Local: Thurs, Mar 22 2012 4:52 pm
Subject: Re: unit testing a freeze
On Thursday, 22. March 2012 15:50:34 Milian Wolff wrote:

> On Thursday 22 March 2012 11:08:35 Dominik Haumann wrote:
> > On Thursday, March 22, 2012 10:47:18 Milian Wolff wrote:
> > > Why not Zoidberg? Uhm I mean: ctest --timeout <seconds>

> > That would do the trick. Is it possible to set this timeout for a single
> > test in CMakeLists.txt?

> yes:

> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_test:TIMEOUT

set_tests_properties(kate-bug286887_test PROPERTIES TIMEOUT 2)

Works - exactly what I was looking for, thanks!

Dominik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »