forked from Imagelibrary/rtems
testsuites: Allow finer control on the fstest result
Changed fstest support to allow control on the test result of each fstest, updated all fstest accordingly. Modified FS_FAIL macro to fail hard and not just print a message which rtems-test runner ignores. Split failing test cases from the ones that passes; added fsrenameexisting, fsrenamepermexisting, fsrmdirparent, fsrenamelongname and fsrenamemaxlinks test cases. Marked fsrenameexisting, fsrenamepermexisting as expected to fail due to #2169. Marked fsrmdirparent as expected to fail, covered by #5071. Marked fssymlink as expected to fail due to rename problems partially covered by #2169. Marked rfsfsrenamelongname as expected to fail, covered by #5069. Marked *fsrenamemaxlinks as expected to fail, covered by #5070. Marked jffs2fsrenamelongname and jffs2nandfsrenamelongname as expected to fail, as JFFS2 seems to not have a limit on the file name, covered by #5073
This commit is contained in:
@@ -22,6 +22,69 @@ actions:
|
|||||||
state: expected-fail
|
state: expected-fail
|
||||||
tests:
|
tests:
|
||||||
- psxfenv01
|
- psxfenv01
|
||||||
|
- set-test-state:
|
||||||
|
reason: |
|
||||||
|
Fails because of #2169, rename to existing entries is
|
||||||
|
not supported
|
||||||
|
state: expected-fail
|
||||||
|
tests:
|
||||||
|
- imfsfsrenameexisting
|
||||||
|
- imfsfsrenamepermexisting
|
||||||
|
- jffs2fsrenameexisting
|
||||||
|
- jffs2fsrenamepermexisting
|
||||||
|
- jffs2nandfsrenameexisting
|
||||||
|
- jffs2nandfsrenamepermexisting
|
||||||
|
- mdosfsfsrenameexisting
|
||||||
|
- mimfsfsrenameexisting
|
||||||
|
- 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
|
||||||
|
state: expected-fail
|
||||||
|
tests:
|
||||||
|
- imfsfssymlink
|
||||||
|
- jffs2fssymlink
|
||||||
|
- jffs2nandfssymlink
|
||||||
|
- mimfsfssymlink
|
||||||
|
- mrfsfssymlink
|
||||||
|
- set-test-state:
|
||||||
|
reason: |
|
||||||
|
Fails because of #5069, NAME_MAX is ignored by RFS
|
||||||
|
state: expected-fail
|
||||||
|
tests:
|
||||||
|
- mrfsfsrenamelongname
|
||||||
|
- set-test-state:
|
||||||
|
reason: |
|
||||||
|
Fails because of #5070, this test seems invalid
|
||||||
|
state: expected-fail
|
||||||
|
tests:
|
||||||
|
- jffs2fsrenamemaxlinks
|
||||||
|
- jffs2nandfsrenamemaxlinks
|
||||||
|
- mdosfsfsrenamemaxlinks
|
||||||
|
- mimfsfsrenamemaxlinks
|
||||||
|
- mrfsfsrenamemaxlinks
|
||||||
|
- set-test-state:
|
||||||
|
reason: |
|
||||||
|
Fails because of #5073, JFFS2 seems to not have appart
|
||||||
|
limits on file name length
|
||||||
|
state: expected-fail
|
||||||
|
tests:
|
||||||
|
- jffs2fsrenamelongname
|
||||||
|
- jffs2nandfsrenamelongname
|
||||||
build-type: option
|
build-type: option
|
||||||
copyrights:
|
copyrights:
|
||||||
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ links:
|
|||||||
uid: imfsfspermission
|
uid: imfsfspermission
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: imfsfsrdwr
|
uid: imfsfsrdwr
|
||||||
|
- role: build-dependency
|
||||||
|
uid: imfsfsrenameexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: imfsfsrenamepermexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: imfsfsrmdirparent
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: imfsfsscandir01
|
uid: imfsfsscandir01
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
@@ -87,6 +93,18 @@ links:
|
|||||||
uid: jffs2fspermission
|
uid: jffs2fspermission
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: jffs2fsrdwr
|
uid: jffs2fsrdwr
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2fsrename
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2fsrenameexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2fsrenamelongname
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2fsrenamemaxlinks
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2fsrenamepermexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2fsrmdirparent
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: jffs2fsscandir01
|
uid: jffs2fsscandir01
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
@@ -103,6 +121,18 @@ links:
|
|||||||
uid: jffs2nandfspermission
|
uid: jffs2nandfspermission
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: jffs2nandfsrdwr
|
uid: jffs2nandfsrdwr
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2nandfsrename
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2nandfsrenameexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2nandfsrenamelongname
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2nandfsrenamemaxlinks
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2nandfsrenamepermexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: jffs2nandfsrmdirparent
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: jffs2nandfsscandir01
|
uid: jffs2nandfsscandir01
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
@@ -117,6 +147,14 @@ links:
|
|||||||
uid: mdosfsfsrdwr
|
uid: mdosfsfsrdwr
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: mdosfsfsrename
|
uid: mdosfsfsrename
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mdosfsfsrenameexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mdosfsfsrenamelongname
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mdosfsfsrenamemaxlinks
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mdosfsfsrmdirparent
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: mdosfsfsscandir01
|
uid: mdosfsfsscandir01
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
@@ -135,6 +173,16 @@ links:
|
|||||||
uid: mimfsfsrdwr
|
uid: mimfsfsrdwr
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: mimfsfsrename
|
uid: mimfsfsrename
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mimfsfsrenameexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mimfsfsrenamelongname
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mimfsfsrenamemaxlinks
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mimfsfsrenamepermexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mimfsfsrmdirparent
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: mimfsfsscandir01
|
uid: mimfsfsscandir01
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
@@ -155,6 +203,16 @@ links:
|
|||||||
uid: mrfsfsrdwr
|
uid: mrfsfsrdwr
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: mrfsfsrename
|
uid: mrfsfsrename
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mrfsfsrenameexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mrfsfsrenamelongname
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mrfsfsrenamemaxlinks
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mrfsfsrenamepermexisting
|
||||||
|
- role: build-dependency
|
||||||
|
uid: mrfsfsrmdirparent
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: mrfsfsscandir01
|
uid: mrfsfsscandir01
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
|
|||||||
21
spec/build/testsuites/fstests/imfsfsrenameexisting.yml
Normal file
21
spec/build/testsuites/fstests/imfsfsrenameexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/imfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenameexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/imfs_fsrenameexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testimfs
|
||||||
21
spec/build/testsuites/fstests/imfsfsrenamepermexisting.yml
Normal file
21
spec/build/testsuites/fstests/imfsfsrenamepermexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/imfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamepermexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/imfs_fsrenamepermexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testimfs
|
||||||
21
spec/build/testsuites/fstests/imfsfsrmdirparent.yml
Normal file
21
spec/build/testsuites/fstests/imfsfsrmdirparent.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/imfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrmdirparent/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/imfs_fsrmdirparent.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testimfs
|
||||||
22
spec/build/testsuites/fstests/jffs2fsrename.yml
Normal file
22
spec/build/testsuites/fstests/jffs2fsrename.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrename/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2_fsrename.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2fsrenameexisting.yml
Normal file
22
spec/build/testsuites/fstests/jffs2fsrenameexisting.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenameexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2_fsrenameexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2fsrenamelongname.yml
Normal file
22
spec/build/testsuites/fstests/jffs2fsrenamelongname.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamelongname/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2_fsrenamelongname.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2fsrenamemaxlinks.yml
Normal file
22
spec/build/testsuites/fstests/jffs2fsrenamemaxlinks.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamemaxlinks/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2_fsrenamemaxlinks.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2fsrenamepermexisting.yml
Normal file
22
spec/build/testsuites/fstests/jffs2fsrenamepermexisting.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamepermexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2_fsrenamepermexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2fsrmdirparent.yml
Normal file
22
spec/build/testsuites/fstests/jffs2fsrmdirparent.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrmdirparent/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2_fsrmdirparent.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2nandfsrename.yml
Normal file
22
spec/build/testsuites/fstests/jffs2nandfsrename.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2023 On-Line Applications Research (OAR)
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_nand_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrename/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2nand_fsrename.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2nand
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2nandfsrenameexisting.yml
Normal file
22
spec/build/testsuites/fstests/jffs2nandfsrenameexisting.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2023 On-Line Applications Research (OAR)
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_nand_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenameexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2nand_fsrenameexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2nand
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2nandfsrenamelongname.yml
Normal file
22
spec/build/testsuites/fstests/jffs2nandfsrenamelongname.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2023 On-Line Applications Research (OAR)
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_nand_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamelongname/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2nand_fsrenamelongname.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2nand
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2nandfsrenamemaxlinks.yml
Normal file
22
spec/build/testsuites/fstests/jffs2nandfsrenamemaxlinks.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2023 On-Line Applications Research (OAR)
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_nand_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamemaxlinks/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2nand_fsrenamemaxlinks.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2nand
|
||||||
|
- jffs2
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2023 On-Line Applications Research (OAR)
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_nand_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamepermexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2nand_fsrenamepermexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2nand
|
||||||
|
- jffs2
|
||||||
22
spec/build/testsuites/fstests/jffs2nandfsrmdirparent.yml
Normal file
22
spec/build/testsuites/fstests/jffs2nandfsrmdirparent.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2023 On-Line Applications Research (OAR)
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/jffs2_nand_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrmdirparent/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/jffs2nand_fsrmdirparent.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testjffs2nand
|
||||||
|
- jffs2
|
||||||
21
spec/build/testsuites/fstests/mdosfsfsrenameexisting.yml
Normal file
21
spec/build/testsuites/fstests/mdosfsfsrenameexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mdosfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenameexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mdosfs_fsrenameexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testdosfs
|
||||||
21
spec/build/testsuites/fstests/mdosfsfsrenamelongname.yml
Normal file
21
spec/build/testsuites/fstests/mdosfsfsrenamelongname.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mdosfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamelongname/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mdosfs_fsrenamelongname.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testdosfs
|
||||||
21
spec/build/testsuites/fstests/mdosfsfsrenamemaxlinks.yml
Normal file
21
spec/build/testsuites/fstests/mdosfsfsrenamemaxlinks.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mdosfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamemaxlinks/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mdosfs_fsrenamemaxlinks.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testdosfs
|
||||||
21
spec/build/testsuites/fstests/mdosfsfsrmdirparent.yml
Normal file
21
spec/build/testsuites/fstests/mdosfsfsrmdirparent.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mdosfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrmdirparent/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mdosfs_fsrmdirparent.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testdosfs
|
||||||
21
spec/build/testsuites/fstests/mimfsfsrenameexisting.yml
Normal file
21
spec/build/testsuites/fstests/mimfsfsrenameexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mimfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenameexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mimfs_fsrenameexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testmimfs
|
||||||
21
spec/build/testsuites/fstests/mimfsfsrenamelongname.yml
Normal file
21
spec/build/testsuites/fstests/mimfsfsrenamelongname.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mimfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamelongname/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mimfs_fsrenamelongname.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testmimfs
|
||||||
21
spec/build/testsuites/fstests/mimfsfsrenamemaxlinks.yml
Normal file
21
spec/build/testsuites/fstests/mimfsfsrenamemaxlinks.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mimfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamemaxlinks/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mimfs_fsrenamemaxlinks.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testmimfs
|
||||||
21
spec/build/testsuites/fstests/mimfsfsrenamepermexisting.yml
Normal file
21
spec/build/testsuites/fstests/mimfsfsrenamepermexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mimfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamepermexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mimfs_fsrenamepermexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testmimfs
|
||||||
21
spec/build/testsuites/fstests/mimfsfsrmdirparent.yml
Normal file
21
spec/build/testsuites/fstests/mimfsfsrmdirparent.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mimfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrmdirparent/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mimfs_fsrmdirparent.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testmimfs
|
||||||
21
spec/build/testsuites/fstests/mrfsfsrenameexisting.yml
Normal file
21
spec/build/testsuites/fstests/mrfsfsrenameexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mrfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenameexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mrfs_fsrenameexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testrfs
|
||||||
21
spec/build/testsuites/fstests/mrfsfsrenamelongname.yml
Normal file
21
spec/build/testsuites/fstests/mrfsfsrenamelongname.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mrfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamelongname/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mrfs_fsrenamelongname.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testrfs
|
||||||
21
spec/build/testsuites/fstests/mrfsfsrenamemaxlinks.yml
Normal file
21
spec/build/testsuites/fstests/mrfsfsrenamemaxlinks.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mrfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamemaxlinks/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mrfs_fsrenamemaxlinks.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testrfs
|
||||||
21
spec/build/testsuites/fstests/mrfsfsrenamepermexisting.yml
Normal file
21
spec/build/testsuites/fstests/mrfsfsrenamepermexisting.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mrfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrenamepermexisting/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mrfs_fsrenamepermexisting.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testrfs
|
||||||
21
spec/build/testsuites/fstests/mrfsfsrmdirparent.yml
Normal file
21
spec/build/testsuites/fstests/mrfsfsrmdirparent.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
build-type: test-program
|
||||||
|
cflags: []
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||||
|
cppflags: []
|
||||||
|
cxxflags: []
|
||||||
|
enabled-by: true
|
||||||
|
features: c cprogram
|
||||||
|
includes:
|
||||||
|
- testsuites/fstests/mrfs_support
|
||||||
|
ldflags: []
|
||||||
|
links: []
|
||||||
|
source:
|
||||||
|
- testsuites/fstests/fsrmdirparent/test.c
|
||||||
|
stlib: []
|
||||||
|
target: testsuites/fstests/mrfs_fsrmdirparent.exe
|
||||||
|
type: build
|
||||||
|
use-after: []
|
||||||
|
use-before:
|
||||||
|
- testrfs
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSERROR " FILESYSTEM;
|
const char rtems_test_name[] = "FSERROR " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static void open_mkdir_error (void)
|
static void open_mkdir_error (void)
|
||||||
{
|
{
|
||||||
@@ -135,7 +136,6 @@ static void rename_error (void)
|
|||||||
char *name01 = "name01";
|
char *name01 = "name01";
|
||||||
char *name02 = "name02";
|
char *name02 = "name02";
|
||||||
char *name03 = "name03";
|
char *name03 = "name03";
|
||||||
char *nonexistence = "name04";
|
|
||||||
|
|
||||||
char name[20];
|
char name[20];
|
||||||
|
|
||||||
@@ -171,11 +171,6 @@ static void rename_error (void)
|
|||||||
status = rename (name02, name01);
|
status = rename (name02, name01);
|
||||||
rtems_test_assert (status != 0);
|
rtems_test_assert (status != 0);
|
||||||
rtems_test_assert (errno == EEXIST || errno == ENOTEMPTY);
|
rtems_test_assert (errno == EEXIST || errno == ENOTEMPTY);
|
||||||
/*
|
|
||||||
* The new directory pathname contains a path prefix
|
|
||||||
* that names the old directory.
|
|
||||||
*/
|
|
||||||
EXPECT_ERROR (EINVAL, rename, name01, name);
|
|
||||||
/*
|
/*
|
||||||
* The new argument points to a directory and
|
* The new argument points to a directory and
|
||||||
* the old argument points to a file that is not a directory.
|
* the old argument points to a file that is not a directory.
|
||||||
@@ -183,15 +178,11 @@ static void rename_error (void)
|
|||||||
fd = creat (name03, mode);
|
fd = creat (name03, mode);
|
||||||
status = close (fd);
|
status = close (fd);
|
||||||
rtems_test_assert (status == 0);
|
rtems_test_assert (status == 0);
|
||||||
EXPECT_ERROR (EISDIR, rename, name03, name02);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The link named by old does not name an existing file,
|
* The link named by old does not name an existing file,
|
||||||
* or either old or new points to an empty string.
|
* or either old or new points to an empty string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPECT_ERROR (ENOENT, rename, nonexistence, name01);
|
|
||||||
EXPECT_ERROR (ENOENT, rename, "", name01);
|
|
||||||
EXPECT_ERROR (ENOENT, rename, name01, "");
|
EXPECT_ERROR (ENOENT, rename, name01, "");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -201,9 +192,7 @@ static void rename_error (void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf (name, "%s/%s", name03, name01);
|
sprintf (name, "%s/%s", name03, name01);
|
||||||
EXPECT_ERROR (ENOTDIR, rename, name, name03);
|
|
||||||
EXPECT_ERROR (ENOTDIR, rename, name03, name);
|
EXPECT_ERROR (ENOTDIR, rename, name03, name);
|
||||||
EXPECT_ERROR (ENOTDIR, rename, name02, name03);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go back to parent directory
|
* Go back to parent directory
|
||||||
@@ -284,8 +273,6 @@ static void rmdir_unlink_error (void)
|
|||||||
* or there are hard links to the directory other than
|
* or there are hard links to the directory other than
|
||||||
* dot or a single entry in dot-dot.
|
* dot or a single entry in dot-dot.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPECT_ERROR (ENOTEMPTY, rmdir, "..");
|
|
||||||
EXPECT_ERROR (ENOTEMPTY, rmdir, "tmp");
|
EXPECT_ERROR (ENOTEMPTY, rmdir, "tmp");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "tmacros.h"
|
#include "tmacros.h"
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSFPATHCONF " FILESYSTEM;
|
const char rtems_test_name[] = "FSFPATHCONF " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static void fpathconf_test(void){
|
static void fpathconf_test(void){
|
||||||
|
|
||||||
@@ -105,7 +106,6 @@ static void fpathconf_test(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void test(void){
|
void test(void){
|
||||||
|
|
||||||
fpathconf_test();
|
fpathconf_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <rtems/jffs2.h>
|
#include <rtems/jffs2.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSJFFS2GC 1";
|
const char rtems_test_name[] = "FSJFFS2GC 1";
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static const rtems_jffs2_info info_initial = {
|
static const rtems_jffs2_info info_initial = {
|
||||||
.flash_size = 131072,
|
.flash_size = 131072,
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSLINK " FILESYSTEM;
|
const char rtems_test_name[] = "FSLINK " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test if the successful call works as expect
|
* Test if the successful call works as expect
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#define BUF_SIZE 100
|
#define BUF_SIZE 100
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSPATHEVAL " FILESYSTEM;
|
const char rtems_test_name[] = "FSPATHEVAL " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static void make_multiple_files (char **files,int is_directory)
|
static void make_multiple_files (char **files,int is_directory)
|
||||||
{
|
{
|
||||||
@@ -54,14 +55,14 @@ static void make_multiple_files (char **files,int is_directory)
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (is_directory){
|
if (is_directory) {
|
||||||
while (files[i]) {
|
while (files[i]) {
|
||||||
printf ("Making directory %s\n", files[i]);
|
printf ("Making directory %s\n", files[i]);
|
||||||
status = mkdir (files[i], S_IRWXU);
|
status = mkdir (files[i], S_IRWXU);
|
||||||
rtems_test_assert (!status);
|
rtems_test_assert (!status);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
while (files[i]) {
|
while (files[i]) {
|
||||||
printf ("Create file %s\n", files[i]);
|
printf ("Create file %s\n", files[i]);
|
||||||
fd=creat(files[i],S_IRWXU);
|
fd=creat(files[i],S_IRWXU);
|
||||||
@@ -84,14 +85,14 @@ static void remove_multiple_files (char **files,int is_directory)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_directory){
|
if (is_directory) {
|
||||||
while (i) {
|
while (i) {
|
||||||
i--;
|
i--;
|
||||||
printf ("Removing directory %s\n", files[i]);
|
printf ("Removing directory %s\n", files[i]);
|
||||||
status = rmdir (files[i]);
|
status = rmdir (files[i]);
|
||||||
rtems_test_assert (!status);
|
rtems_test_assert (!status);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
while (i) {
|
while (i) {
|
||||||
i--;
|
i--;
|
||||||
printf ("Removing file %s\n", files[i]);
|
printf ("Removing file %s\n", files[i]);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSPERMISSION " FILESYSTEM;
|
const char rtems_test_name[] = "FSPERMISSION " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test the umask
|
* Test the umask
|
||||||
@@ -516,136 +517,6 @@ static void root_test(void )
|
|||||||
rtems_test_assert(fd==-1);
|
rtems_test_assert(fd==-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rename_write_permission_test (void)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int status;
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
const char *name01 = "name01";
|
|
||||||
const char *name02 = "name02";
|
|
||||||
|
|
||||||
const char *dir01 = "dir01";
|
|
||||||
const char *dir02 = "dir02";
|
|
||||||
|
|
||||||
char path01[20];
|
|
||||||
|
|
||||||
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
|
||||||
mode_t no_write_access = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP
|
|
||||||
| S_IROTH | S_IXOTH;
|
|
||||||
|
|
||||||
const char *wd = __func__;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file and
|
|
||||||
* the old argument points to another file,
|
|
||||||
* both inside a directory with no write permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename two files on a directory with no write permission \n");
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chdir (dir01);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
fd = creat (name02, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chmod (".", no_write_access);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (EACCES, rename, name01 , name02);
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file in a directory with no write access and
|
|
||||||
* the old argument points to another file on a directory with write access.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename file between two directories, with and without write access\n");
|
|
||||||
|
|
||||||
status = mkdir (dir02, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chdir (dir02);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "../%s/%s", dir01, name02);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
EXPECT_ERROR (EACCES, rename, name01, path01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file in a directory with write access and
|
|
||||||
* the old argument points to another file on a directory without write access.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_ERROR (EACCES, rename, path01, name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "../%s", dir01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
status = chmod (path01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "../%s/%s", dir01, name01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
EXPECT_EQUAL (0, unlink, path01);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "../%s/%s", dir01, name02);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
EXPECT_EQUAL (0, unlink, path01);
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Go back to parent directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove test directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = rmdir (wd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rename_search_permission_test (void)
|
static void rename_search_permission_test (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@@ -656,7 +527,6 @@ static void rename_search_permission_test (void)
|
|||||||
const char *name02 = "name02";
|
const char *name02 = "name02";
|
||||||
|
|
||||||
const char *dir01 = "dir01";
|
const char *dir01 = "dir01";
|
||||||
const char *dir02 = "dir02";
|
|
||||||
|
|
||||||
char path01[20];
|
char path01[20];
|
||||||
char path02[20];
|
char path02[20];
|
||||||
@@ -706,44 +576,9 @@ static void rename_search_permission_test (void)
|
|||||||
|
|
||||||
EXPECT_ERROR (EACCES, rename, path01 , path02);
|
EXPECT_ERROR (EACCES, rename, path01 , path02);
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file in a directory with no execute access and
|
|
||||||
* the old argument points to another file on a directory with execute access.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename file between two directories, with and without execute access\n");
|
|
||||||
|
|
||||||
status = mkdir (dir02, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chdir (dir02);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "%s/%s", dir02, name01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
EXPECT_ERROR (EACCES, rename, path01, path02);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file in a directory with execute access and
|
|
||||||
* the old argument points to another file on a directory without execute access.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_ERROR (EACCES, rename, path02, path01);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear directory
|
* Clear directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, path01);
|
|
||||||
|
|
||||||
status = chmod (dir01, mode);
|
status = chmod (dir01, mode);
|
||||||
rtems_test_assert (status == 0);
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
@@ -752,135 +587,6 @@ static void rename_search_permission_test (void)
|
|||||||
EXPECT_EQUAL (0, unlink, path01);
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
EXPECT_EQUAL (0, unlink, path02);
|
EXPECT_EQUAL (0, unlink, path02);
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Go back to parent directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove test directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = rmdir (wd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_permission03 (void)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int status;
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
const char *name01 = "name01";
|
|
||||||
const char *name02 = "name02";
|
|
||||||
|
|
||||||
const char *dir01 = "dir01";
|
|
||||||
|
|
||||||
char path01[30];
|
|
||||||
|
|
||||||
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
|
||||||
const char *wd = __func__;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file and
|
|
||||||
* the old argument points to another file on a directory with S_ISVTX.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename files within directories protected with S_ISVTX\n");
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode | S_ISVTX);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, name01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
fd = creat (path01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
fd = creat (name02, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chown (path01, 65534, -1);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chown (dir01, 65534, -1);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rename, path01, name02);
|
|
||||||
|
|
||||||
puts("Testing errno for EPERM or EACCES");
|
|
||||||
|
|
||||||
if(errno == EPERM || errno == EACCES)
|
|
||||||
FS_PASS ();
|
|
||||||
else
|
|
||||||
FS_FAIL ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, path01);
|
|
||||||
EXPECT_EQUAL (0, unlink, name02);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file on a directory with S_ISVTX and
|
|
||||||
* the old argument points to a file outside that directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode | S_ISVTX);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, name01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
fd = creat (path01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
fd = creat (name02, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chown (path01, 65534, -1);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = chown (dir01, 65534, -1);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rename, name02, path01);
|
|
||||||
|
|
||||||
puts("Testing errno for EPERM or EACCES");
|
|
||||||
|
|
||||||
if(errno == EPERM || errno == EACCES)
|
|
||||||
FS_PASS ();
|
|
||||||
else
|
|
||||||
FS_FAIL ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, path01);
|
|
||||||
EXPECT_EQUAL (0, unlink, name02);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go back to parent directory
|
* Go back to parent directory
|
||||||
@@ -902,8 +608,6 @@ void test(void )
|
|||||||
umask_test01();
|
umask_test01();
|
||||||
test_permission01();
|
test_permission01();
|
||||||
test_permission02();
|
test_permission02();
|
||||||
test_permission03();
|
|
||||||
root_test();
|
root_test();
|
||||||
rename_write_permission_test();
|
|
||||||
rename_search_permission_test();
|
rename_search_permission_test();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSRDWR " FILESYSTEM;
|
const char rtems_test_name[] = "FSRDWR " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static const mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
static const mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSRENAME " FILESYSTEM;
|
const char rtems_test_name[] = "FSRENAME " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static void rename_file_twice_test (void)
|
static void rename_file_twice_test (void)
|
||||||
{
|
{
|
||||||
@@ -108,68 +109,12 @@ static void rename_opened_file_test (void)
|
|||||||
EXPECT_EQUAL (0, unlink, name02);
|
EXPECT_EQUAL (0, unlink, name02);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void same_file_test (void)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
const char *name01 = "name01";
|
|
||||||
|
|
||||||
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
|
||||||
const char *wd = __func__;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file and
|
|
||||||
* the old argument points to the same file on the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename file with itself\n");
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, rename, name01, name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Go back to parent directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove test directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = rmdir (wd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void directory_test (void)
|
static void directory_test (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int status;
|
int status;
|
||||||
int rv;
|
int rv;
|
||||||
int i;
|
|
||||||
|
|
||||||
const char *name01 = "name01";
|
|
||||||
const char *name02 = "name02";
|
const char *name02 = "name02";
|
||||||
|
|
||||||
const char *dir01 = "dir01";
|
const char *dir01 = "dir01";
|
||||||
@@ -177,15 +122,9 @@ static void directory_test (void)
|
|||||||
|
|
||||||
char path01[30];
|
char path01[30];
|
||||||
|
|
||||||
char link_name[10];
|
|
||||||
|
|
||||||
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
const char *wd = __func__;
|
const char *wd = __func__;
|
||||||
|
|
||||||
struct stat statbuf;
|
|
||||||
|
|
||||||
long LINK_MAX_val;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new directory and change the current directory to this
|
* Create a new directory and change the current directory to this
|
||||||
*/
|
*/
|
||||||
@@ -195,78 +134,6 @@ static void directory_test (void)
|
|||||||
status = chdir (wd);
|
status = chdir (wd);
|
||||||
rtems_test_assert (status == 0);
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file and
|
|
||||||
* the old argument points to a directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename directory with file\n");
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (ENOTDIR, rename, dir01, name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a directory and
|
|
||||||
* the old argument points to a file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename file with directory\n");
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (EISDIR, rename, name01, dir01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to an empty directory and
|
|
||||||
* the old argument points to an ancestor directory of new.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename directory with ancestor directory\n");
|
|
||||||
|
|
||||||
status = mkdir (dir02, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "%s/%s", dir02, dir01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
status = mkdir (path01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (EINVAL, rename, dir02, path01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, rmdir, path01);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The new argument points to an empty directory and
|
* The new argument points to an empty directory and
|
||||||
* the old argument points to a non empty directory.
|
* the old argument points to a non empty directory.
|
||||||
@@ -291,10 +158,11 @@ static void directory_test (void)
|
|||||||
|
|
||||||
puts("Testing errno for EEXIST or ENOTEMPTY");
|
puts("Testing errno for EEXIST or ENOTEMPTY");
|
||||||
|
|
||||||
if(errno == EEXIST || errno == ENOTEMPTY)
|
if (errno == EEXIST || errno == ENOTEMPTY) {
|
||||||
FS_PASS ();
|
FS_PASS ();
|
||||||
else
|
} else {
|
||||||
FS_FAIL ();
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear directory
|
* Clear directory
|
||||||
@@ -304,75 +172,6 @@ static void directory_test (void)
|
|||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to an empty directory and
|
|
||||||
* the old argument points to other empty directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename empty directory with another empty directory\n");
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
status = mkdir (dir02, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, rename, dir01, dir02);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rmdir, dir01);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a non existant directory and
|
|
||||||
* the old argument points to an existant directory at LINK_MAX.
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
LINK_MAX_val = pathconf (dir01, _PC_LINK_MAX);
|
|
||||||
rtems_test_assert (LINK_MAX_val >= 0);
|
|
||||||
|
|
||||||
status = stat (dir01, &statbuf);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
for(i = statbuf.st_nlink; i < LINK_MAX_val; i++)
|
|
||||||
{
|
|
||||||
rv = snprintf (link_name, sizeof(link_name), "%s/%d", dir01, i);
|
|
||||||
rtems_test_assert (rv < sizeof(link_name));
|
|
||||||
|
|
||||||
status = mkdir (link_name, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
status = mkdir (dir02, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, dir01);
|
|
||||||
rtems_test_assert (rv < sizeof(path01));
|
|
||||||
EXPECT_ERROR (EMLINK, rename, dir02, path01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
for(i = statbuf.st_nlink; i < LINK_MAX_val; i++)
|
|
||||||
{
|
|
||||||
rv = snprintf (link_name, sizeof(link_name), "%s/%d", dir01, i);
|
|
||||||
rtems_test_assert (rv < sizeof(link_name));
|
|
||||||
|
|
||||||
status = rmdir (link_name);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rmdir, path01);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go back to parent directory
|
* Go back to parent directory
|
||||||
*/
|
*/
|
||||||
@@ -403,7 +202,6 @@ static void arg_test (void)
|
|||||||
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
const char *wd = __func__;
|
const char *wd = __func__;
|
||||||
|
|
||||||
char filename[NAME_MAX + 2];
|
|
||||||
char path01[20];
|
char path01[20];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -436,25 +234,6 @@ static void arg_test (void)
|
|||||||
EXPECT_EQUAL (-1, unlink, name01);
|
EXPECT_EQUAL (-1, unlink, name01);
|
||||||
EXPECT_EQUAL (0, unlink, name02);
|
EXPECT_EQUAL (0, unlink, name02);
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file and
|
|
||||||
* the old argument points to a non existant file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (ENOENT, rename, name02, name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
EXPECT_EQUAL (-1, unlink, name02);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The new argument points to a non existant file and
|
* The new argument points to a non existant file and
|
||||||
* the old argument points to a file where a component of the
|
* the old argument points to a file where a component of the
|
||||||
@@ -496,173 +275,6 @@ static void arg_test (void)
|
|||||||
EXPECT_EQUAL (-1, rmdir, dir01);
|
EXPECT_EQUAL (-1, rmdir, dir01);
|
||||||
EXPECT_EQUAL (0, rmdir, dir02);
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument is a name bigger than NAME_MAX and
|
|
||||||
* the old argument points to a file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename file with a name size exceeding NAME_MAX\n");
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
/* Generate string with NAME_MAX + 1 length */
|
|
||||||
memset(filename, 'a', NAME_MAX + 1);
|
|
||||||
filename[NAME_MAX + 1] = '\0';
|
|
||||||
|
|
||||||
EXPECT_ERROR (ENAMETOOLONG, rename, name01, filename);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
EXPECT_EQUAL (-1, unlink, filename);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Go back to parent directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = chdir ("..");
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove test directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
status = rmdir (wd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void arg_format_test (void)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
int status;
|
|
||||||
const char *name01 = "name01";
|
|
||||||
|
|
||||||
const char *dir01 = "dir01";
|
|
||||||
|
|
||||||
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
|
||||||
const char *wd = __func__;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a directory and
|
|
||||||
* the old argument points to current directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename directory with current directory\n");
|
|
||||||
|
|
||||||
status = mkdir (dir01, mode);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rename, "." , dir01);
|
|
||||||
|
|
||||||
puts("Testing errno for EINVAL or EBUSY");
|
|
||||||
|
|
||||||
if(errno == EINVAL || errno == EBUSY)
|
|
||||||
FS_PASS ();
|
|
||||||
else
|
|
||||||
FS_FAIL ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to current directory and
|
|
||||||
* the old argument points to a directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rename, dir01, ".");
|
|
||||||
|
|
||||||
puts("Testing errno for EINVAL or EBUSY");
|
|
||||||
|
|
||||||
if(errno == EINVAL || errno == EBUSY)
|
|
||||||
FS_PASS ();
|
|
||||||
else
|
|
||||||
FS_FAIL ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a directory and
|
|
||||||
* the old argument points to previous directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts ("\nRename directory with previous directory\n");
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rename, ".." , dir01);
|
|
||||||
|
|
||||||
puts("Testing errno for EINVAL or EBUSY");
|
|
||||||
|
|
||||||
if(errno == EINVAL || errno == EBUSY)
|
|
||||||
FS_PASS ();
|
|
||||||
else
|
|
||||||
FS_FAIL ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to previous directory and
|
|
||||||
* the old argument points to a directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (-1, rename, dir01, "..");
|
|
||||||
|
|
||||||
puts("Testing errno for EINVAL or EBUSY");
|
|
||||||
|
|
||||||
if(errno == EINVAL || errno == EBUSY)
|
|
||||||
FS_PASS ();
|
|
||||||
else
|
|
||||||
FS_FAIL ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, rmdir, dir01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument points to a file and
|
|
||||||
* the old argument is an empty string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
puts("\nTesting empty filepaths\n");
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (ENOENT, rename, name01, "");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The new argument is an empty string and
|
|
||||||
* the old argument points to a file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
fd = creat (name01, mode);
|
|
||||||
rtems_test_assert (fd >= 0);
|
|
||||||
status = close (fd);
|
|
||||||
rtems_test_assert (status == 0);
|
|
||||||
|
|
||||||
EXPECT_ERROR (ENOENT, rename, "", name01);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear directory
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPECT_EQUAL (0, unlink, name01);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go back to parent directory
|
* Go back to parent directory
|
||||||
*/
|
*/
|
||||||
@@ -744,10 +356,8 @@ static void filesystem_test (void)
|
|||||||
void test (void)
|
void test (void)
|
||||||
{
|
{
|
||||||
rename_file_twice_test ();
|
rename_file_twice_test ();
|
||||||
same_file_test ();
|
|
||||||
directory_test ();
|
directory_test ();
|
||||||
rename_opened_file_test ();
|
rename_opened_file_test ();
|
||||||
arg_test ();
|
arg_test ();
|
||||||
arg_format_test ();
|
|
||||||
filesystem_test ();
|
filesystem_test ();
|
||||||
}
|
}
|
||||||
|
|||||||
465
testsuites/fstests/fsrenameexisting/test.c
Normal file
465
testsuites/fstests/fsrenameexisting/test.c
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2011.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "fstest.h"
|
||||||
|
#include "fs_config.h"
|
||||||
|
#include <tmacros.h>
|
||||||
|
|
||||||
|
const char rtems_test_name[] = "FSRENAMEEXISTING " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
|
static void rename_error (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
char *name01 = "name01";
|
||||||
|
char *name02 = "name02";
|
||||||
|
char *name03 = "name03";
|
||||||
|
char *nonexistence = "name04";
|
||||||
|
|
||||||
|
char name[20];
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*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);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new directory and a new directory in it
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = mkdir (name01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
status = mkdir (name02, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
sprintf (name, "%s/%s", name01, name03);
|
||||||
|
status = mkdir (name, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new directory pathname contains a path prefix
|
||||||
|
* that names the old directory.
|
||||||
|
*/
|
||||||
|
EXPECT_ERROR (EINVAL, rename, name01, name);
|
||||||
|
/*
|
||||||
|
* The new argument points to a directory and
|
||||||
|
* the old argument points to a file that is not a directory.
|
||||||
|
*/
|
||||||
|
fd = creat (name03, mode);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
EXPECT_ERROR (EISDIR, rename, name03, name02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The link named by old does not name an existing file,
|
||||||
|
* or either old or new points to an empty string.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_ERROR (ENOENT, rename, nonexistence, name01);
|
||||||
|
EXPECT_ERROR (ENOENT, rename, "", name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A component of either path prefix is not a directory;
|
||||||
|
* or the old argument names a directory and new argument names
|
||||||
|
* a non-directory file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sprintf (name, "%s/%s", name03, name01);
|
||||||
|
EXPECT_ERROR (ENOTDIR, rename, name, name03);
|
||||||
|
EXPECT_ERROR (ENOTDIR, rename, name02, name03);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void same_file_test (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
const char *name01 = "name01";
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file and
|
||||||
|
* the old argument points to the same file on the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename file with itself\n");
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, rename, name01, name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void directory_test (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
const char *name01 = "name01";
|
||||||
|
|
||||||
|
const char *dir01 = "dir01";
|
||||||
|
const char *dir02 = "dir02";
|
||||||
|
|
||||||
|
char path01[30];
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file and
|
||||||
|
* the old argument points to a directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename directory with file\n");
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_ERROR (ENOTDIR, rename, dir01, name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a directory and
|
||||||
|
* the old argument points to a file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename file with directory\n");
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_ERROR (EISDIR, rename, name01, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to an empty directory and
|
||||||
|
* the old argument points to an ancestor directory of new.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename directory with ancestor directory\n");
|
||||||
|
|
||||||
|
status = mkdir (dir02, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir02, dir01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
status = mkdir (path01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_ERROR (EINVAL, rename, dir02, path01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, rmdir, path01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to an empty directory and
|
||||||
|
* the old argument points to other empty directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename empty directory with another empty directory\n");
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = mkdir (dir02, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, rename, dir01, dir02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rmdir, dir01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void arg_format_test (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
const char *name01 = "name01";
|
||||||
|
|
||||||
|
const char *dir01 = "dir01";
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a directory and
|
||||||
|
* the old argument points to current directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename directory with current directory\n");
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rename, "." , dir01);
|
||||||
|
|
||||||
|
puts("Testing errno for EINVAL or EBUSY");
|
||||||
|
|
||||||
|
if (errno == EINVAL || errno == EBUSY) {
|
||||||
|
FS_PASS ();
|
||||||
|
} else {
|
||||||
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to current directory and
|
||||||
|
* the old argument points to a directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rename, dir01, ".");
|
||||||
|
|
||||||
|
puts("Testing errno for EINVAL or EBUSY");
|
||||||
|
|
||||||
|
if (errno == EINVAL || errno == EBUSY) {
|
||||||
|
FS_PASS ();
|
||||||
|
} else {
|
||||||
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a directory and
|
||||||
|
* the old argument points to previous directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename directory with previous directory\n");
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rename, ".." , dir01);
|
||||||
|
|
||||||
|
puts("Testing errno for EINVAL or EBUSY");
|
||||||
|
|
||||||
|
if (errno == EINVAL || errno == EBUSY) {
|
||||||
|
FS_PASS ();
|
||||||
|
} else {
|
||||||
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to previous directory and
|
||||||
|
* the old argument points to a directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rename, dir01, "..");
|
||||||
|
|
||||||
|
puts("Testing errno for EINVAL or EBUSY");
|
||||||
|
|
||||||
|
if (errno == EINVAL || errno == EBUSY) {
|
||||||
|
FS_PASS ();
|
||||||
|
} else {
|
||||||
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file and
|
||||||
|
* the old argument is an empty string.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts("\nTesting empty filepaths\n");
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_ERROR (ENOENT, rename, name01, "");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument is an empty string and
|
||||||
|
* the old argument points to a file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_ERROR (ENOENT, rename, "", name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test (void)
|
||||||
|
{
|
||||||
|
rename_error ();
|
||||||
|
same_file_test ();
|
||||||
|
directory_test ();
|
||||||
|
arg_format_test ();
|
||||||
|
}
|
||||||
108
testsuites/fstests/fsrenamelongname/test.c
Normal file
108
testsuites/fstests/fsrenamelongname/test.c
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2011.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "fstest.h"
|
||||||
|
#include "fs_config.h"
|
||||||
|
#include <tmacros.h>
|
||||||
|
|
||||||
|
const char rtems_test_name[] = "FSRENAMELONGNAME " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
|
void test (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
const char *name01 = "name01";
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
char filename[NAME_MAX + 2];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument is a name bigger than NAME_MAX and
|
||||||
|
* the old argument points to a file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename file with a name size exceeding NAME_MAX\n");
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/* Generate string with NAME_MAX + 1 length */
|
||||||
|
memset(filename, 'a', NAME_MAX + 1);
|
||||||
|
filename[NAME_MAX + 1] = '\0';
|
||||||
|
|
||||||
|
EXPECT_ERROR (ENAMETOOLONG, rename, name01, filename);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
EXPECT_EQUAL (-1, unlink, filename);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
137
testsuites/fstests/fsrenamemaxlinks/test.c
Normal file
137
testsuites/fstests/fsrenamemaxlinks/test.c
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2011.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "fstest.h"
|
||||||
|
#include "fs_config.h"
|
||||||
|
#include <tmacros.h>
|
||||||
|
|
||||||
|
const char rtems_test_name[] = "FSRENAMEMAXLINKS " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
|
void test (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
int rv;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
const char *dir01 = "dir01";
|
||||||
|
const char *dir02 = "dir02";
|
||||||
|
|
||||||
|
char path01[30];
|
||||||
|
|
||||||
|
char link_name[10];
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
|
long LINK_MAX_val;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a non existant directory and
|
||||||
|
* the old argument points to an existant directory at LINK_MAX.
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
LINK_MAX_val = pathconf (dir01, _PC_LINK_MAX);
|
||||||
|
rtems_test_assert (LINK_MAX_val >= 0);
|
||||||
|
|
||||||
|
status = stat (dir01, &statbuf);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
for(i = statbuf.st_nlink; i < LINK_MAX_val; i++)
|
||||||
|
{
|
||||||
|
rv = snprintf (link_name, sizeof(link_name), "%s/%d", dir01, i);
|
||||||
|
rtems_test_assert (rv < sizeof(link_name));
|
||||||
|
|
||||||
|
status = mkdir (link_name, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = mkdir (dir02, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, dir01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
EXPECT_ERROR (EMLINK, rename, dir02, path01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
for(i = statbuf.st_nlink; i < LINK_MAX_val; i++)
|
||||||
|
{
|
||||||
|
rv = snprintf (link_name, sizeof(link_name), "%s/%d", dir01, i);
|
||||||
|
rtems_test_assert (rv < sizeof(link_name));
|
||||||
|
|
||||||
|
status = rmdir (link_name);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rmdir, path01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
428
testsuites/fstests/fsrenamepermexisting/test.c
Normal file
428
testsuites/fstests/fsrenamepermexisting/test.c
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2011.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "fstest.h"
|
||||||
|
#include "fs_config.h"
|
||||||
|
#include <tmacros.h>
|
||||||
|
|
||||||
|
const char rtems_test_name[] = "FSRENAMEPERMEXISTING " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
|
static void rename_write_permission_test (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
const char *name01 = "name01";
|
||||||
|
const char *name02 = "name02";
|
||||||
|
|
||||||
|
const char *dir01 = "dir01";
|
||||||
|
const char *dir02 = "dir02";
|
||||||
|
|
||||||
|
char path01[20];
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
mode_t no_write_access = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP
|
||||||
|
| S_IROTH | S_IXOTH;
|
||||||
|
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file and
|
||||||
|
* the old argument points to another file,
|
||||||
|
* both inside a directory with no write permission.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename two files on a directory with no write permission \n");
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chdir (dir01);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
fd = creat (name02, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chmod (".", no_write_access);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_ERROR (EACCES, rename, name01 , name02);
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file in a directory with no write access and
|
||||||
|
* the old argument points to another file on a directory with write access.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename file between two directories, with and without write access\n");
|
||||||
|
|
||||||
|
status = mkdir (dir02, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chdir (dir02);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "../%s/%s", dir01, name02);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
EXPECT_ERROR (EACCES, rename, name01, path01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file in a directory with write access and
|
||||||
|
* the old argument points to another file on a directory without write access.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_ERROR (EACCES, rename, path01, name01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, name01);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "../%s", dir01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
status = chmod (path01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "../%s/%s", dir01, name01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "../%s/%s", dir01, name02);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rename_search_permission_test (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
const char *name01 = "name01";
|
||||||
|
const char *name02 = "name02";
|
||||||
|
|
||||||
|
const char *dir01 = "dir01";
|
||||||
|
const char *dir02 = "dir02";
|
||||||
|
|
||||||
|
char path01[20];
|
||||||
|
char path02[20];
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
mode_t no_execute_access = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
|
||||||
|
| S_IROTH | S_IWOTH;
|
||||||
|
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file in a directory with no execute access and
|
||||||
|
* the old argument points to another file on a directory with execute access.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename file between two directories, with and without execute access\n");
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, name01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
fd = creat (path01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path02, sizeof(path02), "%s/%s", dir01, name02);
|
||||||
|
rtems_test_assert (rv < sizeof(path02));
|
||||||
|
fd = creat (path02, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chmod (dir01, no_execute_access);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = mkdir (dir02, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chdir (dir02);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
fd = creat (name01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir02, name01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
EXPECT_ERROR (EACCES, rename, path01, path02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file in a directory with execute access and
|
||||||
|
* the old argument points to another file on a directory without execute access.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_ERROR (EACCES, rename, path02, path01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
|
|
||||||
|
status = chmod (dir01, mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, name01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
|
EXPECT_EQUAL (0, unlink, path02);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir02);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rename_permission03 (void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int status;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
const char *name01 = "name01";
|
||||||
|
const char *name02 = "name02";
|
||||||
|
|
||||||
|
const char *dir01 = "dir01";
|
||||||
|
|
||||||
|
char path01[30];
|
||||||
|
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file and
|
||||||
|
* the old argument points to another file on a directory with S_ISVTX.
|
||||||
|
*/
|
||||||
|
|
||||||
|
puts ("\nRename files within directories protected with S_ISVTX\n");
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode | S_ISVTX);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, name01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
fd = creat (path01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
fd = creat (name02, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chown (path01, 65534, -1);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chown (dir01, 65534, -1);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rename, path01, name02);
|
||||||
|
|
||||||
|
puts("Testing errno for EPERM or EACCES");
|
||||||
|
|
||||||
|
if (errno == EPERM || errno == EACCES) {
|
||||||
|
FS_PASS ();
|
||||||
|
} else {
|
||||||
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
|
EXPECT_EQUAL (0, unlink, name02);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new argument points to a file on a directory with S_ISVTX and
|
||||||
|
* the old argument points to a file outside that directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = mkdir (dir01, mode | S_ISVTX);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
rv = snprintf (path01, sizeof(path01), "%s/%s", dir01, name01);
|
||||||
|
rtems_test_assert (rv < sizeof(path01));
|
||||||
|
fd = creat (path01, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
fd = creat (name02, mode);
|
||||||
|
rtems_test_assert (fd >= 0);
|
||||||
|
status = close (fd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chown (path01, 65534, -1);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
status = chown (dir01, 65534, -1);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
EXPECT_EQUAL (-1, rename, name02, path01);
|
||||||
|
|
||||||
|
puts("Testing errno for EPERM or EACCES");
|
||||||
|
|
||||||
|
if (errno == EPERM || errno == EACCES) {
|
||||||
|
FS_PASS ();
|
||||||
|
} else {
|
||||||
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_EQUAL (0, unlink, path01);
|
||||||
|
EXPECT_EQUAL (0, unlink, name02);
|
||||||
|
EXPECT_EQUAL (0, rmdir, dir01);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove test directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
status = rmdir (wd);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test (void)
|
||||||
|
{
|
||||||
|
rename_write_permission_test ();
|
||||||
|
rename_search_permission_test ();
|
||||||
|
rename_permission03 ();
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
#include <rtems/malloc.h>
|
#include <rtems/malloc.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSRFSBITMAP 1";
|
const char rtems_test_name[] = "FSRFSBITMAP 1";
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
#define rtems_rfs_exit_on_error(_rc, _r, _c, _b) \
|
#define rtems_rfs_exit_on_error(_rc, _r, _c, _b) \
|
||||||
if ((_rc > 0) || _r) { free (_b); rtems_rfs_bitmap_close (_c); return; }
|
if ((_rc > 0) || _r) { free (_b); rtems_rfs_bitmap_close (_c); return; }
|
||||||
|
|||||||
88
testsuites/fstests/fsrmdirparent/test.c
Normal file
88
testsuites/fstests/fsrmdirparent/test.c
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2011.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "fstest.h"
|
||||||
|
#include "fs_config.h"
|
||||||
|
#include <tmacros.h>
|
||||||
|
|
||||||
|
const char rtems_test_name[] = "FSRMDIRPARENT " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
|
static void rmdir_error (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
|
|
||||||
|
const char *wd = __func__;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a new directory for test
|
||||||
|
*/
|
||||||
|
status = mkdir ("tmp", mode);
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The path argument names a directory that is not an empty directory,
|
||||||
|
* or there are hard links to the directory other than
|
||||||
|
* dot or a single entry in dot-dot.
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPECT_ERROR (ENOTEMPTY, rmdir, "..");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go back to parent directory
|
||||||
|
*/
|
||||||
|
status = chdir ("..");
|
||||||
|
rtems_test_assert (status == 0);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void test (void)
|
||||||
|
{
|
||||||
|
rmdir_error ();
|
||||||
|
}
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
#include "fs_config.h"
|
#include "fs_config.h"
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSSCANDIR " FILESYSTEM;
|
const char rtems_test_name[] = "FSSCANDIR " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
#define FILE_NAME "aaa"
|
#define FILE_NAME "aaa"
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSSTATVFS " FILESYSTEM;
|
const char rtems_test_name[] = "FSSTATVFS " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
static void statvfs_validate(struct statvfs *stat)
|
static void statvfs_validate(struct statvfs *stat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,10 +45,8 @@
|
|||||||
#include "fs_config.h"
|
#include "fs_config.h"
|
||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
//#include "fstest_support.h"
|
|
||||||
//#include <limits.h>
|
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSSYMLINK " FILESYSTEM;
|
const char rtems_test_name[] = "FSSYMLINK " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test the function of symlink
|
* Test the function of symlink
|
||||||
@@ -232,10 +230,11 @@ static void symlink_rename_test (void)
|
|||||||
|
|
||||||
puts ("Testing if name02 is now a symlink");
|
puts ("Testing if name02 is now a symlink");
|
||||||
|
|
||||||
if(S_ISLNK(statbuf.st_mode) != 0)
|
if (S_ISLNK(statbuf.st_mode) != 0) {
|
||||||
FS_PASS ();
|
FS_PASS ();
|
||||||
else
|
} else {
|
||||||
FS_FAIL ();
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear directory
|
* Clear directory
|
||||||
@@ -270,10 +269,11 @@ static void symlink_rename_test (void)
|
|||||||
|
|
||||||
puts ("Testing that symlink01 is not a symlink");
|
puts ("Testing that symlink01 is not a symlink");
|
||||||
|
|
||||||
if(S_ISLNK(statbuf.st_mode) == 0)
|
if (S_ISLNK(statbuf.st_mode) == 0) {
|
||||||
FS_PASS ();
|
FS_PASS ();
|
||||||
else
|
} else {
|
||||||
FS_FAIL ();
|
FS_FAIL ();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear directory
|
* Clear directory
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
|
||||||
const char rtems_test_name[] = "FSTIME " FILESYSTEM;
|
const char rtems_test_name[] = "FSTIME " FILESYSTEM;
|
||||||
|
const RTEMS_TEST_STATE rtems_test_state = TEST_STATE;
|
||||||
#else
|
#else
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#define rtems_test_assert(x) assert(x)
|
#define rtems_test_assert(x) assert(x)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#define FS_PASS() do {puts("PASS");} while (0)
|
#define FS_PASS() do {puts("PASS");} while (0)
|
||||||
#define FS_FAIL() do {\
|
#define FS_FAIL() do {\
|
||||||
printf( "FAIL %s: %d \n", __FILE__, __LINE__ );\
|
printf( "FAIL %s: %d \n", __FILE__, __LINE__ );\
|
||||||
|
fs_test_notify_failure(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +68,8 @@
|
|||||||
FS_FAIL();\
|
FS_FAIL();\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
void fs_test_notify_failure(void);
|
||||||
void test(void);
|
void test(void);
|
||||||
|
|
||||||
#define BASE_FOR_TEST "/mnt"
|
#define BASE_FOR_TEST "/mnt"
|
||||||
|
|||||||
@@ -50,6 +50,15 @@
|
|||||||
|
|
||||||
void *volatile prevent_compiler_optimizations;
|
void *volatile prevent_compiler_optimizations;
|
||||||
|
|
||||||
|
static int fs_test_failed = 0;
|
||||||
|
extern const RTEMS_TEST_STATE rtems_test_state;
|
||||||
|
|
||||||
|
void fs_test_notify_failure(void)
|
||||||
|
{
|
||||||
|
fs_test_failed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Break out of a chroot() environment in C */
|
/* Break out of a chroot() environment in C */
|
||||||
static void break_out_of_chroot(void)
|
static void break_out_of_chroot(void)
|
||||||
{
|
{
|
||||||
@@ -76,7 +85,7 @@ rtems_task Init(
|
|||||||
{
|
{
|
||||||
int rc=0;
|
int rc=0;
|
||||||
|
|
||||||
TEST_BEGIN();
|
rtems_test_begin(rtems_test_name, rtems_test_state);
|
||||||
|
|
||||||
puts( "Initializing filesystem " FILESYSTEM );
|
puts( "Initializing filesystem " FILESYSTEM );
|
||||||
test_initialize_filesystem();
|
test_initialize_filesystem();
|
||||||
@@ -91,6 +100,6 @@ rtems_task Init(
|
|||||||
puts( "\n\nShutting down filesystem " FILESYSTEM );
|
puts( "\n\nShutting down filesystem " FILESYSTEM );
|
||||||
test_shutdown_filesystem();
|
test_shutdown_filesystem();
|
||||||
|
|
||||||
TEST_END();
|
if (!fs_test_failed) rtems_test_end(rtems_test_name);
|
||||||
rtems_test_exit(0);
|
rtems_test_exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user