From mboxrd@z Thu Jan 1 00:00:00 1970 From: Krzysztof Kozlowski Date: Wed, 1 Sep 2021 17:16:55 +0200 Subject: [LTP] [PATCH v5 3/3] controllers/cpuacct: fix rmdir failures on early test abort In-Reply-To: <20210901151655.95760-1-krzysztof.kozlowski@canonical.com> References: <20210901151655.95760-1-krzysztof.kozlowski@canonical.com> Message-ID: <20210901151655.95760-3-krzysztof.kozlowski@canonical.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it The "testpath" variable is assigned at the end of setup(), so if test exits early, the "rmdir $testpath" is wrong: cpuacct 1 TCONF: not enough of memory on this system (less than 3840 MB) cpuacct 1 TINFO: removing created directories rmdir: missing operand Try 'rmdir --help' for more information. Signed-off-by: Krzysztof Kozlowski --- Changes since v1: 1. None. --- testcases/kernel/controllers/cpuacct/cpuacct.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/controllers/cpuacct/cpuacct.sh b/testcases/kernel/controllers/cpuacct/cpuacct.sh index 39f880a53996..e95d4b53f936 100755 --- a/testcases/kernel/controllers/cpuacct/cpuacct.sh +++ b/testcases/kernel/controllers/cpuacct/cpuacct.sh @@ -120,12 +120,13 @@ cleanup() { tst_res TINFO "removing created directories" - if [ -d "$testpath/subgroup_1" ]; then - rmdir $testpath/subgroup_* + if [ "$testpath" ]; then + if [ -d "$testpath/subgroup_1" ]; then + rmdir $testpath/subgroup_* + fi + rmdir $testpath fi - rmdir $testpath - if [ "$mounted" -ne 1 ]; then tst_res TINFO "Umounting cpuacct" umount $mount_point -- 2.30.2