strange cppunit test bug - result that is compared changes when modifying the expected value

Stephan Bergmann sbergman at redhat.com
Thu Oct 10 11:04:44 CEST 2013


On 10/10/2013 02:06 AM, Christian Lohmaier wrote:
> make CppunitTest_sw_ooxmlexport
>
> fails on the CentOS 5.9 release-build system because of a weired bug I
> cannot quite explain:
>
> fdo66929.docx,ooxmlexport.cxx:1067:Assertion
> Test name: Test::run
> equality assertion failed
> - Expected: 127
> - Actual  : 254
>
> line 1067 is:
>      CPPUNIT_ASSERT_EQUAL( sal_Int32( 127 ), getProperty< sal_Int32 >(
> xFrame, "BottomBorderDistance" ) );
>
> So the test tells that BottomBorderDistance value was not the expected
> value, HOWEVER:
>
> I change that line from 127 to 128:
>      CPPUNIT_ASSERT_EQUAL( sal_Int32( 128 ), getProperty< sal_Int32 >(
> xFrame, "BottomBorderDistance" ) );
>
> and run the test again, and now I get:
> fdo66929.docx,ooxmlexport.cxx:1067:Assertion
> Test name: Test::run
> equality assertion failed
> - Expected: 128
> - Actual  : 127
>
> So mysteriously now the actual value is the correct/the initially expected one?!
>
> I assumed corrupted ccache, so I cleared that, also used
> CCACHE_DISABLE=1 - but neither helped. When I change it back to 127, I
> get the initial error again. Actual value is claimed to be 254.

Sounds like a compiler bug then, esp. since getProperty 
(sw/qa/extras/inc/swmodeltestbase.hxx) contains

>         T data = T();
>         properties->getPropertyValue( name ) >>= data;

so does initialize data to zero in case >>= fails.

> Same behavior when I disable the other value-checks and only have it
> check for BottomBorderDistance.

Does it still report 254 if the preceding line

>     CPPUNIT_ASSERT_EQUAL( sal_Int32( 254 ), getProperty< sal_Int32 >( xFrame, "RightBorderDistance" ) );

is removed?

Stephan


More information about the LibreOffice mailing list