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] [RFC] shell wrappers for tst_checkpoint
Date: Mon, 6 Jun 2016 10:40:43 +0200	[thread overview]
Message-ID: <20160606084043.GA11753@rei> (raw)
In-Reply-To: <57504983.5010106@oracle.com>

Hi!
>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 70345e5..00eeeae 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -100,6 +100,10 @@ tst_exit()
>  		$TST_CLEANUP
>  	fi
>  
> +	if [ -n "$LTP_IPC_PATH" -a -f "$LTP_IPC_PATH" ]; then
> +		rm -f "$LTP_IPC_PATH"
> +	fi
> +
>  	# Mask out TINFO
>  	exit $((LTP_RET_VAL & ~16))
>  }
> @@ -374,6 +378,16 @@ tst_module_exists()
>  	tst_brkm TCONF "Failed to find module '$mod_name'"
>  }
>  
> +TST_CHECKPOINT_WAIT()
> +{
> +	ROD tst_checkpoint_wait "$1" 10000
> +}
> +
> +TST_CHECKPOINT_WAKE()
> +{
> +	ROD tst_checkpoint_wake "$1" 10000
> +}

Given that we have wrappers for the checkpoint programs anyway, we can
build just one binary called tst_checkpoint and pass the wait/wake as
first parameter. That way we can spare us the special rules in Makefile
and ifdefs in the checkpoint C source.

>  # Check that test name is set
>  if [ -z "$TCID" ]; then
>  	tst_brkm TBROK "TCID is not defined"
> @@ -393,3 +407,16 @@ if [ -z "$LTPROOT" ]; then
>  else
>  	export LTP_DATAROOT="$LTPROOT/testcases/data/$TCID"
>  fi
> +
> +if [ "$TST_NEEDS_CHECKPOINTS" = "1" ]; then
> +	LTP_IPC_PATH="/dev/shm/ltp_$$"

We may also include the $TCID in the filename, since that would make
identifying which tests possibly failed to cleanup easier...

> +	LTP_IPC_SIZE=$(getconf PAGESIZE)
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TBROK "getconf PAGESIZE failed"
> +	fi
> +
> +	ROD_SILENT dd if=/dev/zero of="$LTP_IPC_PATH" bs="$LTP_IPC_SIZE" count=1
> +	ROD_SILENT chmod 600 "$LTP_IPC_PATH"
> +	export LTP_IPC_PATH
> +fi

Otherwise this looks good.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2016-06-06  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 14:34 [LTP] [RFC] shell wrappers for tst_checkpoint Stanislav Kholmanskikh
2016-06-01 14:34 ` [LTP] [RFC PATCH 1/2] a draft for tst_checkpoint shell wrappers Stanislav Kholmanskikh
2016-06-01 14:34 ` [LTP] [RFC PATCH 2/2] An example of usage of " Stanislav Kholmanskikh
2016-06-01 15:12   ` Cyril Hrubis
2016-06-01 15:03 ` [LTP] [RFC] shell wrappers for tst_checkpoint Cyril Hrubis
2016-06-02 14:58   ` Stanislav Kholmanskikh
2016-06-06  8:40     ` Cyril Hrubis [this message]
2016-06-02  7:58 ` Jan Stancek
2016-06-02  8:20   ` Stanislav Kholmanskikh

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=20160606084043.GA11753@rei \
    --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