From bd7e02d96b5e22487656f95cfad8c078ce20c7c5 Mon Sep 17 00:00:00 2001 From: Loris Nardo Date: Sun, 28 Jul 2024 07:53:50 +0200 Subject: [PATCH] testsuites: Fix fstests/fsrmdirparent testcase The testcase failed because the rmdir call in that case had two possibilities to fail and the implementation of rmdir checked the other possibility first. Closes #5071 --- spec/build/bsps/tst.yml | 12 ------------ testsuites/fstests/fsrmdirparent/test.c | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/spec/build/bsps/tst.yml b/spec/build/bsps/tst.yml index de00d8f7f2..a62645bcdd 100644 --- a/spec/build/bsps/tst.yml +++ b/spec/build/bsps/tst.yml @@ -39,18 +39,6 @@ actions: - mimfsfsrenamepermexisting - mrfsfsrenameexisting - mrfsfsrenamepermexisting -- set-test-state: - reason: | - Fails because of #5071, dot-dot as last part of a path - is treated as valid - state: expected-fail - tests: - - imfsfsrmdirparent - - jffs2fsrmdirparent - - jffs2nandfsrmdirparent - - mdosfsfsrmdirparent - - mimfsfsrmdirparent - - mrfsfsrmdirparent - set-test-state: reason: | Fails because of #2169 and other rename issue diff --git a/testsuites/fstests/fsrmdirparent/test.c b/testsuites/fstests/fsrmdirparent/test.c index 541a8f1b71..6dfc532f53 100644 --- a/testsuites/fstests/fsrmdirparent/test.c +++ b/testsuites/fstests/fsrmdirparent/test.c @@ -52,13 +52,24 @@ static void rmdir_error (void) const char *wd = __func__; /* - * Create a new directory and change the current directory to this + * Create a new directory and change the current directory to this */ status = mkdir (wd, mode); rtems_test_assert (status == 0); status = chdir (wd); rtems_test_assert (status == 0); + /* + * Try to remove the relative parent directory + */ + EXPECT_EQUAL (-1, rmdir, ".."); + puts ("Testing errno for ENOTEMPTY or EBUSY"); + if ( errno == ENOTEMPTY || errno == EBUSY ) { + FS_PASS (); + } else { + FS_FAIL (); + } + /* * Create a new directory for test */ @@ -70,8 +81,7 @@ static void rmdir_error (void) * or there are hard links to the directory other than * dot or a single entry in dot-dot. */ - - EXPECT_ERROR (ENOTEMPTY, rmdir, ".."); + EXPECT_ERROR (ENOTEMPTY, rmdir, "tmp/.."); /* * Go back to parent directory