Re: [LTP] [PATCH] testcases:Fix the failure of shell script to get path

Petr Vorel
2023-04-04T13:37:07Z

> For example, in the file testcases/kernel/controllers/cpuset/cpuset_funcs.sh, if the path is obtained by
> find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read subdir, the escaped characters will be lost,
> and by adding the -r option, the escaped characters will be kept as they are without escaping
> The errors are as follows:
> /opt/ltp/testcases/bin/cpuset_funcs.sh:line178: /dev/cpuset/machine.slice/machine-qemux2d157x2dzhx2dsxf.scope/vcpu7/tasks: The file or directory is not available

Could you print the path how it looks like with ls:

ls -l /dev/cpuset/machine.slice/

FYI cgroup tests written in shell are broken by design, we write new tests in C.
Not sure if these old tests are relevant enough to be rewritten into C.

...
> +++ b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
> @@ -312,7 +312,7 @@ generate_locate_test_makefile buildonly '.test' "$buildonly_compiler_args"
> generate_locate_test_makefile runnable '.run-test'
> generate_locate_test_makefile test-tools ''

> -find . -name Makefile.1 -exec dirname {} \; | while read dir; do
> +find . -name Makefile.1 -exec dirname {} \; | while read -r dir; do
I don't think it's needed for open posix.

Kind regards,
Petr