diff mbox series

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

Message ID 20230508013914.245451-1-zenghao@kylinos.cn
State Accepted
Headers show
Series [v3] testcases:Fix the failure of shell script to get path | expand

Commit Message

Hao Zeng May 8, 2023, 1:39 a.m. UTC
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
rmdir: delete
'/dev/cpuset/machine.slice/machine-qemux2d157x2dzhx2dsxf.scope/vcpu7'
Failure: The file or directory is not available
cpuset_memory_pressure 1 TFAIL: Couldn't remove subdir -
/opt/ltp/testcases/bin/cpuset_funcs.sh:line178:
/dev/cpuset/machine.slice/machine-qemux2d157x2dzhx2dsxf.scope/vcpu7/tasks:
The file or directory is not available
rmdir: delete
'/dev/cpuset/machine.slice/machine-qemux2d157x2dzhx2dsxf.scope/vcpu7'
Failure: The file or directory is not available
cpuset_memory_pressure 1 TFAIL: Couldn't remove subdir -

Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
Suggested-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh | 2 +-
 testcases/kernel/controllers/cpuset/cpuset_funcs.sh          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Petr Vorel May 9, 2023, 5:47 a.m. UTC | #1
Hi,

> Signed-off-by: Hao Zeng <zenghao@kylinos.cn>

> Suggested-by: Petr Vorel <pvorel@suse.cz>
I actually didn't suggest this, the above should not be added.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Let's see if it's accepted before the release or after.

Kind regards,
Petr
Cyril Hrubis May 12, 2023, 11:45 a.m. UTC | #2
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Petr Vorel May 12, 2023, 12:22 p.m. UTC | #3
Hi,

merged, with slightly reworded commit message.

Thanks!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh b/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
index ab73c801b..5cb6bb566 100755
--- a/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
+++ b/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
@@ -63,7 +63,7 @@  cleanup()
 		return 0
 	}
 
-	find $CPUCTL -type d | sort | sed -n '2,$p' | tac | while read tmpdir
+	find $CPUCTL -type d | sort | sed -n '2,$p' | tac | while read -r tmpdir
 	do
 		while read tmppid
 		do
diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
index 87ba7da1f..0cfa0c17e 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
@@ -184,7 +184,7 @@  cleanup()
 	echo $CHILDREN_VALUE > $CLONE_CHILDREN
 	echo $SCHED_LB_VALUE > $SCHED_LB
 
-	find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read subdir
+	find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read -r subdir
 	do
 		while read pid
 		do