Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] codan test does not fail if StackOverflowError is thrown

Is the exception being "swallowed" at line 1062 of AbstractIndexerTask.parseFile:

	} catch (StackOverflowError e) {
		th= e;

If so, then it will only be thrown back to your test case if it has happened more than 500 times.

Since that causes parseFile to return null, maybe you can change the test case to assert that the file is in the index?

-Andrew

On 14-03-27 01:07 AM, Nathan Ridge wrote:
> I tried to add the following test to AbstractClassInstantiationCheckerTest.java:
> 
>     //  template <int I>
>     //  struct S : S<I - 1> {};
>     //
>     //  S<1> waldo;
>     public void testMaxInstantiationDepth_430282() throws Exception {
>         // Just check that codan runs without any exceptions being thrown.
>         loadCodeAndRun(getAboveComment());
>     }
> 
> Running AbstractClassInstantiationChecker on this code causes infinite
> recursion in SemanticQueries.PureVirtualMethodCollector.collectFinalOverriders(),
> leading to a StackOverflowError (this is the bug I am writing the test for).
> 
> I would expect that this causes the test to fail; however, the test succeeds.
> (I know the exception is being thrown because I can see it in the Console
> when I run the test.)
> 
> How can I write a test that fails if StackOverflowError is thrown?
> 
> Thanks,
> Nate 		 	   		  
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 



Back to the top