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

zenghao zenghao@kylinos.cn
Thu Apr 6 04:58:16 CEST 2023


Dear Petr
Thank you for taking the time to reply to my email. I appreciate your 
prompt response and the valuable information you have provided.

在 2023/4/4 21:36, Petr Vorel 写道:
>> 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/
ls -l /dev/cpuset/machine.slice/
-rw-r--r-- 1 root root 0  Apr  5 13:44  cgroup.clone_children
-rw-r--r-- 1 root root 0  Apr  5 13:44  cgroup.procs
-rw-r--r-- 1 root root 0  Apr  5 13:44  cpuset.cpu_exclusive
-rw-r--r-- 1 root root 0  Apr  4 17:41  cpuset.cpus
-r--r--r-- 1 root root 0  Apr  5 13:44  cpuset.effective_cpus
-r--r--r-- 1 root root 0  Apr  5 13:44  cpuset.effective_mems
-rw-r--r-- 1 root root 0  Apr  5 13:44  cpuset.mem_exclusive
-rw-r--r-- 1 root root 0  Apr  5 13:44  cpuset.mem_hardwall
-rw-r--r-- 1 root root 0  Apr  4 17:41  cpuset.memory_migrate
-r--r--r-- 1 root root 0  Apr  5 13:44  cpuset.memory_pressure
-rw-r--r-- 1 root root 0  Apr  5 13:44  cpuset.memory_spread_page
-rw-r--r-- 1 root root 0  Apr  5 13:44  cpuset.memory_spread_slab
-rw-r--r-- 1 root root 0  Apr  4 17:41  cpuset.mems
-rw-r--r-- 1 root root 0  Apr  5 13:44  cpuset.sched_load_balance
-rw-r--r-- 1 root root 0  Apr  5 13:44 cpuset.sched_relax_domain_level
drwxr-xr-x 6 root root 0  Apr  5 13:44 
'machine-qemu\x2d3\x2dzh\x2dnode1.scope'
-rw-r--r-- 1 root root 0  Apr  5 13:44  notify_on_release
-rw-r--r-- 1 root root 0  Apr  5 13:44  tasks
>
> 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.
>
> ...
get it
>> +++ 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.
I agree with your viewpoint.
>
> Kind regards,
> Petr
Best regards
Hao


More information about the ltp mailing list