* [LTP] [PATCH] open_posix_testsuite: Fix variable type error @ 2010-10-18 9:32 Gui Jianfeng 2010-10-18 9:56 ` Garrett Cooper 0 siblings, 1 reply; 3+ messages in thread From: Gui Jianfeng @ 2010-10-18 9:32 UTC (permalink / raw) To: ltp-list 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. Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> --- .../functional/threads/pi_test/pitest-1.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/testcases/ /functional/threads/pi_test/pitest-1.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c index b8969a8..9fac992 100644 --- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c @@ -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) { -- 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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] open_posix_testsuite: Fix variable type error 2010-10-18 9:32 [LTP] [PATCH] open_posix_testsuite: Fix variable type error Gui Jianfeng @ 2010-10-18 9:56 ` Garrett Cooper 2010-10-18 10:24 ` Gui Jianfeng 0 siblings, 1 reply; 3+ messages in thread From: Garrett Cooper @ 2010-10-18 9:56 UTC (permalink / raw) To: Gui Jianfeng; +Cc: ltp-list [-- Attachment #1: Type: text/plain, Size: 1274 bytes --] On Mon, Oct 18, 2010 at 2:32 AM, Gui Jianfeng <guijianfeng@cn.fujitsu.com> wrote: > 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. > > Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> > --- > .../functional/threads/pi_test/pitest-1.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/testcases/ /functional/threads/pi_test/pitest-1.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c > index b8969a8..9fac992 100644 > --- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c > +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c > @@ -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 [-- Attachment #2: pitest-1-use-time_t.diff --] [-- Type: application/octet-stream, Size: 1291 bytes --] diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c index b8969a8..fe03ccf 100644 --- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c @@ -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", [-- Attachment #3: Type: text/plain, Size: 369 bytes --] ------------------------------------------------------------------------------ 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 [-- Attachment #4: Type: text/plain, Size: 155 bytes --] _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] open_posix_testsuite: Fix variable type error 2010-10-18 9:56 ` Garrett Cooper @ 2010-10-18 10:24 ` Gui Jianfeng 0 siblings, 0 replies; 3+ messages in thread From: Gui Jianfeng @ 2010-10-18 10:24 UTC (permalink / raw) To: Garrett Cooper; +Cc: ltp-list Garrett Cooper wrote: > On Mon, Oct 18, 2010 at 2:32 AM, Gui Jianfeng > <guijianfeng@cn.fujitsu.com> wrote: >> 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. >> >> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> >> --- >> .../functional/threads/pi_test/pitest-1.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/testcases/ /functional/threads/pi_test/pitest-1.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c >> index b8969a8..9fac992 100644 >> --- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c >> +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c >> @@ -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. Works good for me. Gui > 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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-18 10:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-10-18 9:32 [LTP] [PATCH] open_posix_testsuite: Fix variable type error Gui Jianfeng 2010-10-18 9:56 ` Garrett Cooper 2010-10-18 10:24 ` Gui Jianfeng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox