Linux Test Project
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 4/7] openposix: sem_timedwait/11-1: Fix
Date: Tue, 05 Jul 2022 06:34:44 +0100	[thread overview]
Message-ID: <87let8rujw.fsf@suse.de> (raw)
In-Reply-To: <91377e86-da37-2987-72a2-3e5cf44bdec6@suse.cz>

Hello,

Martin Doucha <mdoucha@suse.cz> writes:

> Hi,
> small suggestion below, otherwise it looks good.
>
> Reviewed-by: Martin Doucha <mdoucha@suse.cz>
>
> On 20. 06. 22 11:21, Cyril Hrubis wrote:
>> Actually run both of the cases (valid timeout and invalid timeout).
>> 
>> The timeout is not actually invalid, but rather in the past, which is
>> important to test as the system has to try to lock the semaphore first
>> and only if that fails it should check the timeout.
>> 
>> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
>> ---
>>  .../conformance/interfaces/sem_timedwait/11-1.c          | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>> 
>> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/11-1.c
>> index f87afaa43..663edd836 100644
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/11-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/11-1.c
>> @@ -24,7 +24,7 @@
>>  #include "posixtest.h"
>>  
>>  #define TIMEOUT 2
>> -#define INVALIDTIMEOUT -2
>> +#define NEGATIVETIMEOUT -2
>>  #define TEST "11-1"
>>  #define FUNCTION "sem_timedwait"
>>  #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
>> @@ -45,7 +45,7 @@ int main(void)
>>  			ts[i].tv_sec = time(NULL) + TIMEOUT;
>>  			ts[i].tv_nsec = 0;
>>  		} else if (i == 1) {
>> -			ts[i].tv_sec = time(NULL) + INVALIDTIMEOUT;
>> +			ts[i].tv_sec = time(NULL) + NEGATIVETIMEOUT;
>>  			ts[i].tv_nsec = 0;
>>  		}
>>  		/* Lock Semaphore */
>> @@ -63,13 +63,14 @@ int main(void)
>>  
>>  		/* Checking if the value of the Semaphore decremented by one */
>>  		if ((val[i] == 0) && (sts[i] == 0)) {
>> -			puts("TEST PASSED");
>>  			sem_destroy(&mysemp[i]);
>
> It'd be better to move sem_destroy() above the condition. See code
> example at the end.
>
>> -			return PTS_PASS;
>>  		} else {
>>  			puts("TEST FAILED");
>>  			sem_destroy(&mysemp[i]);
>>  			return PTS_FAIL;
>>  		}
>>  	}
>> +
>> +	puts("TEST PASSED");
>> +	return PTS_PASS;
>>  }
>
> ...
>
> 	sem_destroy(&mysemp[i]);

And with that also:

Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>

>
> 	/* Checking if the value of the Semaphore decremented by one */
> 	if ((val[i] != 0) || (sts[i] != 0)) {
> 		puts("TEST FAILED");
> 		return PTS_FAIL;
> 	}
>
> 	puts("TEST PASSED");
> 	return PTS_PASS;
> }
>
> -- 
> Martin Doucha   mdoucha@suse.cz
> QA Engineer for Software Maintenance
> SUSE LINUX, s.r.o.
> CORSO IIa
> Krizikova 148/34
> 186 00 Prague 8
> Czech Republic


-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-07-05  5:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  9:21 [LTP] [PATCH 0/7] openposix: Fix 'no return in nonvoid function' warnings Cyril Hrubis
2022-06-20  9:21 ` [LTP] [PATCH 1/7] openposix: pthread_rwlockattr_getpshared/2-1: Fix Cyril Hrubis
2022-07-05  5:16   ` Richard Palethorpe
2022-06-20  9:21 ` [LTP] [PATCH 2/7] openposix: pthread_spin_init/{2-1,2-2}: Fix Cyril Hrubis
2022-07-05  5:20   ` Richard Palethorpe
2022-06-20  9:21 ` [LTP] [PATCH 3/7] openposix: sem_destroy/3-1: Fix Cyril Hrubis
2022-07-05  5:23   ` Richard Palethorpe
2022-06-20  9:21 ` [LTP] [PATCH 4/7] openposix: sem_timedwait/11-1: Fix Cyril Hrubis
2022-06-23  9:57   ` Martin Doucha
2022-07-05  5:34     ` Richard Palethorpe [this message]
2022-06-20  9:21 ` [LTP] [PATCH 5/7] openposix: aio_h/2-1: Add return at the end of main() Cyril Hrubis
2022-07-05  5:24   ` Richard Palethorpe
2022-06-20  9:21 ` [LTP] [PATCH 6/7] openposix: mq_timedreceive: Silence warning Cyril Hrubis
2022-07-05  5:25   ` Richard Palethorpe
2022-06-20  9:21 ` [LTP] [PATCH 7/7] opeposix: pthread_barrierattr_getpshared/2-1: Simplify codeflow Cyril Hrubis
2022-06-23 12:38   ` Martin Doucha
2022-07-05  5:35     ` Richard Palethorpe
2022-07-14 13:03     ` Cyril Hrubis
2022-06-23  8:49 ` [LTP] [PATCH 0/7] openposix: Fix 'no return in nonvoid function' warnings Li Wang
2022-07-14 13:05   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87let8rujw.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox