From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v4 3/5] shell: Add timeout shell API tests
Date: Wed, 2 Oct 2019 12:46:17 +0200 [thread overview]
Message-ID: <20191002104617.GA8313@dell5510> (raw)
In-Reply-To: <20190930145916.20465-4-pvorel@suse.cz>
Hi,
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> lib/newlib_tests/shell/test_timeout.sh | 38 ++++++++++++++++++++++++++
> lib/newlib_tests/shell/timeout01.sh | 13 +++++++++
> lib/newlib_tests/shell/timeout02.sh | 13 +++++++++
> 3 files changed, 64 insertions(+)
> create mode 100755 lib/newlib_tests/shell/test_timeout.sh
> create mode 100755 lib/newlib_tests/shell/timeout01.sh
> create mode 100755 lib/newlib_tests/shell/timeout02.sh
> diff --git a/lib/newlib_tests/shell/test_timeout.sh b/lib/newlib_tests/shell/test_timeout.sh
> new file mode 100755
> index 000000000..7e296f9e9
> --- /dev/null
> +++ b/lib/newlib_tests/shell/test_timeout.sh
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +
> +PATH="$(dirname $0)/../../../testcases/lib/:$PATH"
I put PATH here, as it's the only runner and not prolong this fix.
If we want more sophisticated functionality from these test of the library
itself runners, we could create some common.sh library here, which would set
PATH and do other things (counting failures and report them etc).
> +
> +DATA="
> +timeout01.sh||0
> +timeout02.sh||0
> +timeout02.sh|foo|32
> +timeout02.sh|2|0
> +timeout02.sh|1.1|0
> +timeout02.sh|-10|32
> +"
> +
> +echo "Testing timeout in shell API"
> +echo
> +
> +failed=0
> +IFS="
> +"
> +for i in $DATA; do
> + file=$(echo $i | cut -d'|' -f1)
> + timeout=$(echo $i | cut -d'|' -f2)
> + exp_exit=$(echo $i | cut -d'|' -f3)
> +
> + echo "=== $test (LTP_TIMEOUT_MUL='$timeout') ==="
> + LTP_TIMEOUT_MUL=$timeout ./$file
> + ret=$?
> + if [ $ret -ne $exp_exit ]; then
> + echo "FAILED (exit code: $ret, expected $exp_exit)"
> + failed=$((failed+1))
> + else
> + echo "PASSED"
> + fi
> + echo
> +done
> +
> +echo "Failed tests: $failed"
> +exit $failed
next prev parent reply other threads:[~2019-10-02 10:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 14:59 [LTP] [RFC PATCH v4 0/5] shell: Introduce TST_TIMEOUT variable Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 1/5] shell: Add tst_is_num() Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 2/5] shell: Introduce TST_TIMEOUT variable, add checks Petr Vorel
2019-10-09 14:34 ` Cyril Hrubis
2019-10-11 8:12 ` Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 3/5] shell: Add timeout shell API tests Petr Vorel
2019-10-02 10:46 ` Petr Vorel [this message]
2019-10-09 14:36 ` Cyril Hrubis
2019-10-11 8:17 ` Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 4/5] memcg_stress_test.sh: use TST_TIMEOUT (replace LTP_TIMEOUT_MUL) Petr Vorel
2019-09-30 14:59 ` [LTP] [RFC PATCH v4 5/5] net/if-mtu-change.sh: set TST_TIMEOUT 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=20191002104617.GA8313@dell5510 \
--to=pvorel@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