public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] syscalls/nanosleep03: remove duplicated nanosleep03
Date: Tue, 30 Jul 2019 13:21:20 +0200	[thread overview]
Message-ID: <20190730112120.GA10214@rei.lan> (raw)
In-Reply-To: <1564363652-3975-1-git-send-email-xuyang2018.jy@cn.fujitsu.com>

Hi!
> diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep01.c b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
> index 96e1cf1b4..418f86565 100644
> --- a/testcases/kernel/syscalls/nanosleep/nanosleep01.c
> +++ b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
> @@ -1,21 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0-or-lat
                                             ^
					   later
>  /*
>   * Copyright (c) International Business Machines  Corp., 2001
>   *  07/2001 Ported by Wayne Boyer
>   * Copyright (C) 2015-2017 Cyril Hrubis <chrubis@suse.cz>
> - *
> - * This program is free software;  you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY;  without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> - * the GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program;  if not, write to the Free Software Foundation,
> - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>  
>  /*
> @@ -25,7 +12,6 @@
>   */
>  
>  #include <errno.h>
> -
>  #include "tst_timer_test.h"
>  
>  int sample_fn(int clk_id, long long usec)
> diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep02.c b/testcases/kernel/syscalls/nanosleep/nanosleep02.c
> index 8bd2c44c4..20a93d3b6 100644
> --- a/testcases/kernel/syscalls/nanosleep/nanosleep02.c
> +++ b/testcases/kernel/syscalls/nanosleep/nanosleep02.c
> @@ -10,6 +10,9 @@
>   *  Verify that nanosleep() will be successful to suspend the execution
>   *  of a process, returns after the receipt of a signal and writes the
>   *  remaining sleep time into the structure.
> + *
> + *  This test also verifies that if the call is interrupted by a signal
> + *  handler, nanosleep() returns -1, sets errno to EINTR.
>   */
>  
>  #include <errno.h>
> @@ -39,11 +42,13 @@ static void do_child(void)
>  	TEST(nanosleep(&timereq, &timerem));
>  	tst_timer_stop();
>  
> -	if (!TST_RET)
> +	if (TST_RET != -1)
>  		tst_brk(TBROK, "nanosleep was not interrupted");

We should probably print the TST_RET after this change.

>  	if (TST_ERR != EINTR)
>  		tst_brk(TBROK | TTERRNO, "nanosleep() failed");

And I guess that we should change these two messages to tst_res(TFAIL,
followed by return;

> +	tst_res(TPASS, "nanosleep() returned -1, set errno to EINTER");
> +
>  	if (tst_timespec_lt(timereq, tst_timer_elapsed()))
>  		tst_brk(TFAIL, "nanosleep() slept more than timereq");
>  

Other than these minor issues the patch is OK.

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2019-07-30 11:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29  1:27 [LTP] [PATCH 1/2] syscalls/nanosleep03: remove duplicated nanosleep03 Yang Xu
2019-07-29  1:27 ` [LTP] [PATCH 2/2] syscalls/nanosleep04: Ported into new library Yang Xu
2019-07-30 11:36   ` Cyril Hrubis
2019-07-30 11:21 ` Cyril Hrubis [this message]
2019-07-31  6:24   ` [LTP] [PATCH v2] syscalls/nanosleep03: remove duplicated nanosleep03 Yang Xu
2019-07-31  6:32   ` [LTP] [PATCH v3] " Yang Xu
2019-08-06  9:29     ` Yang Xu
2019-08-13 16:03       ` Petr Vorel

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=20190730112120.GA10214@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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