From: Richard Palethorpe <rpalethorpe@suse.de>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] lib: Add ROD shell API test
Date: Fri, 02 Sep 2022 10:57:17 +0100 [thread overview]
Message-ID: <874jxq14ay.fsf@suse.de> (raw)
In-Reply-To: <20220727151657.2242-1-pvorel@suse.cz>
Hello,
Petr Vorel <pvorel@suse.cz> writes:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> lib/newlib_tests/runtest.sh | 2 +-
> lib/newlib_tests/shell/rod.sh | 30 ++++++++++++++++++++++++++++++
> 2 files changed, 31 insertions(+), 1 deletion(-)
> create mode 100755 lib/newlib_tests/shell/rod.sh
>
> diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh
> index f136bcb88..5b75fe2c7 100755
> --- a/lib/newlib_tests/runtest.sh
> +++ b/lib/newlib_tests/runtest.sh
> @@ -8,7 +8,7 @@ tst_fuzzy_sync03 test_zero_hugepage.sh test_kconfig.sh
> test_children_cleanup.sh}"
>
> LTP_SHELL_API_TESTS="${LTP_SHELL_API_TESTS:-shell/tst_check_driver.sh
> -shell/tst_check_kconfig0[1-5].sh shell/net/*.sh}"
> +shell/tst_check_kconfig0[1-5].sh shell/rod.sh shell/net/*.sh}"
>
> cd $(dirname $0)
> PATH="$PWD/../../testcases/lib/:$PATH"
> diff --git a/lib/newlib_tests/shell/rod.sh b/lib/newlib_tests/shell/rod.sh
> new file mode 100755
> index 000000000..e05516d0b
> --- /dev/null
> +++ b/lib/newlib_tests/shell/rod.sh
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2022 Petr Vorel <pvorel@suse.cz>
> +
> +TST_TESTFUNC="test"
> +TST_NEEDS_TMPDIR=1
> +TST_CNT=3
> +
> +test1()
> +{
> + ROD cd /
> + EXPECT_PASS [ "$PWD" != "/" ]
> +}
> +
> +test2()
> +{
> + ROD echo foo > /nonexisting-file
If we are running as root then this will succeed?
I suppose we don't usually run the lib tests as root, but wouldn't it be
better to create a file and write protect it, then try redirecting to it?
> + tst_res TPASS "ROD redirecting without qoting continue on failure. NOTE: proper syntax needs to escape '>': ROD echo foo \> /nonexisting-file"
> + EXPECT_FAIL 'cat /nonexisting-file'
> +}
> +
> +test3()
> +{
> + ROD echo foo \> file
> + tst_res TPASS "ROD redirect quoting syntax works"
> + EXPECT_PASS '[ $(cat file) = foo ]'
> +}
> +
> +. tst_test.sh
> +tst_run
> --
> 2.37.1
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-09-02 10:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 15:16 [LTP] [PATCH 1/1] lib: Add ROD shell API test Petr Vorel
2022-09-02 9:57 ` Richard Palethorpe [this message]
2022-10-11 9:26 ` Richard Palethorpe
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=874jxq14ay.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=pvorel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.