Skip to contentSkip to conversation

open_posix_testsuite: Fix variable type error

PATCH In review Gui Jianfeng 2 participants 3 messages Oct 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 open_posix_testsuite: Fix variable type error

Hi

Currently, the variable "timeout" type is int, We should make it to be "unsigned long". Otherwise, we'll get an unexpected value in thread function, consequently, test fails.

---
 .../functional/threads/pi_test/pitest-1.c          |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +1 -1
index b8969a8..9fac992 100644
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
 
 	/* Start TB thread (boosting thread) */
 	DPRINTF(stderr,"Main Thread: start TB thread\n");
-	int timeout = multiplier * 20;
+	unsigned long timeout = multiplier * 20;
 	rc = pthread_create(&threadtb, &threadattr, thread_tb, 
 			    &timeout);
         if (rc != 0) {
Signature · 13 lines
1.7.0.4


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 15 lines · Gui Jianfeng

Hi

Currently, the variable "timeout" type is int, We should make it to be "unsigned long". Otherwise, we'll get an unexpected value in thread function, consequently, test fails.

---
 .../functional/threads/pi_test/pitest-1.c          |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +0 -0
index b8969a8..9fac992 100644

testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c int main(int argc, char **argv) · line 302

Quoted 8 lines
testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +1 -1
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
 
        /* Start TB thread (boosting thread) */
        DPRINTF(stderr,"Main Thread: start TB thread\n");
-       int timeout = multiplier * 20;
+       unsigned long timeout = multiplier * 20;
        rc = pthread_create(&threadtb, &threadattr, thread_tb,
                            &timeout);
         if (rc != 0) {

Please try this patch out instead and let me know how it goes.
Thanks,
-Garrett

testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +4 -5
index b8969a8..fe03ccf 100644
@@ -197,7 +197,7 @@ void *thread_sample(void *arg)
 
 void *thread_tb(void *arg)
 {
-	unsigned long timeoutsec;
+	time_t timeoutsec;
 	struct timespec boost_time;
 	double seconds, t0, t1;
 	int rc;
@@ -206,8 +206,7 @@ void *thread_tb(void *arg)
 	
 	DPRINTF(stdout, "#EVENT %f TB Starts\n", seconds_read() - base_time);
 
-	timeoutsec = *(unsigned long*) arg;
-	boost_time.tv_sec = time(NULL) + (time_t)timeoutsec;
+	boost_time.tv_sec = time(NULL) + *((time_t*) arg);
 	boost_time.tv_nsec = 0;
 	
 	t0 = seconds_read();
@@ -296,8 +295,8 @@ int main(int argc, char **argv)
 
 	/* Start TB thread (boosting thread) */
 	DPRINTF(stderr,"Main Thread: start TB thread\n");
-	int timeout = multiplier * 20;
-	rc = pthread_create(&threadtb, &threadattr, thread_tb, 
+	time_t timeout = multiplier * 20;
+	rc = pthread_create(&threadtb, &threadattr, thread_tb,
 			    &timeout);
         if (rc != 0) {
                 EPRINTF("UNRESOLVED: pthread_create: %d %s",

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 18 lines · Garrett Cooper
Quoted 16 lines · Gui Jianfeng

Hi

Currently, the variable "timeout" type is int, We should make it to be "unsigned long". Otherwise, we'll get an unexpected value in thread function, consequently, test fails.

---
 .../functional/threads/pi_test/pitest-1.c          |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +0 -0
index b8969a8..9fac992 100644
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
 
Quoted 9 lines

testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c int main(int argc, char **argv) · line 301

Quoted 7 lines
testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +1 -1
       /* Start TB thread (boosting thread) */
       DPRINTF(stderr,"Main Thread: start TB thread\n");
-       int timeout = multiplier * 20;
+       unsigned long timeout = multiplier * 20;
       rc = pthread_create(&threadtb, &threadattr, thread_tb,
                           &timeout);
        if (rc != 0) {

Please try this patch out instead and let me know how it goes.

Works good for me.

Gui

Quoted 2 lines

Thanks,
-Garrett

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list