[LTP] [PATCH 1/1] controllers/cpuacct: Simplify deleting directories

Petr Vorel pvorel@suse.cz
Thu Sep 2 18:19:57 CEST 2021


by using rm -rf instead of 2x rmdir and checks for dir presence.

Also move TINFO to print it only when relevant.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/controllers/cpuacct/cpuacct.sh b/testcases/kernel/controllers/cpuacct/cpuacct.sh
index b2347e801..99258c266 100755
--- a/testcases/kernel/controllers/cpuacct/cpuacct.sh
+++ b/testcases/kernel/controllers/cpuacct/cpuacct.sh
@@ -119,13 +119,10 @@ setup()
 
 cleanup()
 {
-	tst_res TINFO "removing created directories"
 
 	if [ "$testpath" ]; then
-		if [ -d "$testpath/subgroup_1" ]; then
-			rmdir $testpath/subgroup_*
-		fi
-		rmdir $testpath
+		tst_res TINFO "removing created directories"
+		rm -rf $testpath
 	fi
 
 	if [ "$mounted" -ne 1 ]; then
-- 
2.33.0



More information about the ltp mailing list