openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1600106 - /openoffice/trunk/main/sal/qa/osl/condition/osl_Condition.cxx
Date Wed, 04 Jun 2014 11:21:52 GMT
Author: hdu
Date: Wed Jun  4 11:21:52 2014
New Revision: 1600106

URL: http://svn.apache.org/r1600106
Log:
#i125003# fix google-test for osl_condition in the sal module

the test didn't initialize the nanosecond part of the condition timeout and so
the absolute timeout calculated from the second and nanosecond values could
become invalid depending on the pseudo-random value of the nanosecond member.
This resulted in spurious gtest failures (first seen on Ubuntu).

Modified:
    openoffice/trunk/main/sal/qa/osl/condition/osl_Condition.cxx

Modified: openoffice/trunk/main/sal/qa/osl/condition/osl_Condition.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/osl/condition/osl_Condition.cxx?rev=1600106&r1=1600105&r2=1600106&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/osl/condition/osl_Condition.cxx (original)
+++ openoffice/trunk/main/sal/qa/osl/condition/osl_Condition.cxx Wed Jun  4 11:21:52 2014
@@ -216,46 +216,45 @@ namespace osl_Condition
 		Result wait(const TimeValue *pTimeout = 0)
 	*/
     TEST(Sal_Test_Condition, wait_001) {
-        TimeValue tv1;
-        tv1.Seconds = 1;
-        
+        TimeValue tv1 = {1,0};
+
         ::osl::Condition cond1;
         ::osl::Condition cond2;
         ::osl::Condition cond3;
-		
+
         cond1.set();
         cond2.set();
-		
+
         osl::Condition::Result r1=cond1.wait(&tv1);
         osl::Condition::Result r2=cond2.wait();
         osl::Condition::Result r3=cond3.wait(&tv1);
         fprintf(stderr,"%d %d %d\n",r1,r2,r3);
 
         // #test comment#: test three types of wait.
-        ASSERT_TRUE( (cond1.wait(&tv1) == ::osl::Condition::result_ok) &&
-                     (cond2.wait() == ::osl::Condition::result_ok) &&
-                     (cond3.wait(&tv1) == ::osl::Condition::result_timeout) );
+        ASSERT_TRUE( cond1.wait(&tv1) == ::osl::Condition::result_ok );
+        ASSERT_TRUE( cond2.wait() == ::osl::Condition::result_ok );
+        ASSERT_TRUE( cond3.wait(&tv1) == ::osl::Condition::result_timeout );
     }
 
     TEST(Sal_Test_Condition, wait_002) {
-        TimeValue tv1;
-        tv1.Seconds = 1;
-        
+        TimeValue tv1 = {1,0};
+
         ::osl::Condition aCond;
         ::osl::Condition::Result wRes, wRes1;
-			
+
         aCond.reset( );
         sal_Bool bRes = aCond.check( );
         wRes = aCond.wait( &tv1 );
-			
+
         aCond.set( );
         wRes1 = aCond.wait( &tv1 );
         sal_Bool bRes1 = aCond.check( );
 
         // #test comment#: wait a condition after set/reset.
-        ASSERT_TRUE( !bRes && bRes1 &&
-                     ( ::osl::Condition::result_timeout == wRes ) && 
-                     ( ::osl::Condition::result_ok == wRes1 ) );
+        ASSERT_TRUE( !bRes );
+        ASSERT_TRUE( bRes1 );
+        ASSERT_TRUE( ::osl::Condition::result_timeout == wRes );
+        ASSERT_TRUE( ::osl::Condition::result_ok == wRes1 );
     }
 
 
@@ -288,7 +287,8 @@ namespace osl_Condition
         sal_Bool bRes1 = aCond.check( );
 
         // #test comment#: use threads to set/reset Condition and check it in main routine.
-        ASSERT_TRUE( bRes && !bRes1 );
+        ASSERT_TRUE( bRes );
+        ASSERT_TRUE( !bRes1 );
     }
 
 } // namespace osl_Condition



Mime
View raw message