Re: [LTP] [PATCH 2/2 v2] checkpoints: fix usage in children started via exec

Wanlong Gao
2014-10-07T00:46:54Z

On 10/06/2014 10:55 PM, Jan Stancek wrote:
> creat07 and setpgid03 are currently failing in following way:
> CHILD: Failed to open fifo '': No such file or directory at creat07_child.c:31
> creat07 1 TBROK : tst_checkpoint.c:126: Checkpoint timeouted after 5000 msecs at creat07.c:78
> creat07 2 TBROK : tst_checkpoint.c:126: Remaining cases broken
>
> These testcases start children via exec, so only initialize
> checkpoint struct, FIFO has been already created by parent.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>

Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

> ---
> testcases/kernel/syscalls/creat/creat07_child.c | 8 ++++++--
> .../kernel/syscalls/setpgid/setpgid03_child.c | 8 +++++++-
> 2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/creat/creat07_child.c b/testcases/kernel/syscalls/creat/creat07_child.c
> index f3e6aa0..1641601 100644
> --- a/testcases/kernel/syscalls/creat/creat07_child.c
> +++ b/testcases/kernel/syscalls/creat/creat07_child.c
> @@ -24,10 +24,14 @@
>
> char *TCID = "creat07_child";
>
> -static struct tst_checkpoint checkpoint = {.timeout = 5, .retval = 1};
> -
> int main(void)
> {
> + struct tst_checkpoint checkpoint;
> +
> + /* we are already in tmpdir, so only initialize checkpoint,
> + * fifo has been created by parent already. */
> + TST_CHECKPOINT_INIT(&checkpoint);
> +
> TST_CHECKPOINT_SIGNAL_PARENT(&checkpoint);
>
> for (;;) {
> diff --git a/testcases/kernel/syscalls/setpgid/setpgid03_child.c b/testcases/kernel/syscalls/setpgid/setpgid03_child.c
> index c4cf892..c9ea87f 100644
> --- a/testcases/kernel/syscalls/setpgid/setpgid03_child.c
> +++ b/testcases/kernel/syscalls/setpgid/setpgid03_child.c
> @@ -20,10 +20,16 @@
>
> char *TCID = "setpgid03_child";
>
> -static struct tst_checkpoint checkpoint = { .timeout = 10000, .retval = 1};
>
> int main(void)
> {
> + struct tst_checkpoint checkpoint;
> +
> + /* we are already in tmpdir, so only initialize checkpoint,
> + * fifo has been created by parent already. */
> + TST_CHECKPOINT_INIT(&checkpoint);
> + checkpoint.timeout = 10000;
> +
> TST_CHECKPOINT_SIGNAL_PARENT(&checkpoint);
> TST_CHECKPOINT_CHILD_WAIT(&checkpoint);