Hi Philipp,
On Thu, Aug 11, 2022 at 12:29 AM Philipp Rudo <prudo(a)redhat.com> wrote:
Hi Tao,
On Mon, 8 Aug 2022 19:52:26 +0800
Tao Liu <ltao(a)redhat.com> wrote:
> Previously, all files within $TESTCASEDIR/$test_case are regarded
> as shell script files for testing. However there might be config
> files under the directory. So let's only iterate the .sh files.
>
> Signed-off-by: Tao Liu <ltao(a)redhat.com>
> ---
> tests/scripts/run-test.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh
> index 1501db4..68df5fd 100755
> --- a/tests/scripts/run-test.sh
> +++ b/tests/scripts/run-test.sh
> @@ -85,8 +85,8 @@ for test_case in $testcases; do
> results[$test_case]="<Test Skipped>"
>
> testdir=$TESTCASEDIR/$test_case
> - script_num=$(ls -1 $testdir | wc -l)
> - scripts=$(ls -r -1 $testdir | tr '\n' ' ')
> + script_num=$(ls -1 $testdir | egrep "\.sh$" | wc -l)
I don't see any user for script_num. I think you can simply drop it.
Thanks, I will drop it.
> + scripts=$(ls -r -1 $testdir | egrep "\.sh$" | tr
'\n' ' ')
Instead of piping to egrep you can simply use the bash globbing, i.e.
ls -r -1 $testdir/*.sh ...
I'm afraid it cannot be modified this way. For command like:
$ ls -r -1 fc-kexec-tools/*.sh
fc-kexec-tools/kdump-restart.sh
fc-kexec-tools/kdump-migrate-action.sh
fc-kexec-tools/kdump-logger.sh
...
$ ls -r -1 fc-kexec-tools | egrep "\.sh$"
kdump-restart.sh
kdump-migrate-action.sh
kdump-logger.sh
kdump-lib.sh
...
There shouldn't be any folder name for the variable "scripts".
The complete path of "script" will later be assembled by
"$testdir/$script".
I tested the change and it will fail.
Thanks,
Tao Liu
Thanks
Philipp
> test_outputs=""
> read main_script aux_script <<< "$scripts"
>