[LTP] [PATCH 1/1] lib: Add ROD shell API test

Richard Palethorpe rpalethorpe@suse.de
Tue Oct 11 11:26:57 CEST 2022


Hello,

Richard Palethorpe <rpalethorpe@suse.de> writes:

> 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?

Marking as "changes requested", to remove it from the queue.

-- 
Thank you,
Richard.


More information about the ltp mailing list