summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/tar01/tar01.scn
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-12-01 16:39:46 +0100
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2021-12-09 08:23:47 +0100
commitffc57e3cf33ec0e2cc51ce214cedc24f390a7ea5 (patch)
tree210db2da29d65be56aff24dfc737c036a8707854 /testsuites/libtests/tar01/tar01.scn
parentscore: Fix _Workspace_Initialize_for_one_area() (diff)
downloadrtems-ffc57e3cf33ec0e2cc51ce214cedc24f390a7ea5.tar.bz2
untar: Make behavior similar to GNU or BSD tar
RTEMS untar implementation had problems with overwriting or integrating archives into existing directory structures. This patch adapts the behavior to mimic that of a GNU tar or BSD tar and extends the tar01 test to check for the behavior. That is: * If a directory structure exists, the files from the archive will be integrated. Existing files are overwritten. * If a file exists and the archive contains a directory with the same name, the file is removed and a directory is created. In the above example: if l1/l2 is a file it will be overwritten with a new directory. * If a directory exists and the archive contains a file with the same name, the directory will be replaced if it is empty. If it contains files, the result is an error. * An archive also can contain only a file without the parent directories. If in that case one of the parent directories exists as a file extracting the archive results in an error. In the example: if l1/l2 is a file and the archive doesn't contain the directories but only the file l1/l2/x.txt that would be an error. * In case of an error, it is possible that the archive has been partially extracted. Closes #4568
Diffstat (limited to 'testsuites/libtests/tar01/tar01.scn')
-rw-r--r--testsuites/libtests/tar01/tar01.scn54
1 files changed, 46 insertions, 8 deletions
diff --git a/testsuites/libtests/tar01/tar01.scn b/testsuites/libtests/tar01/tar01.scn
index 68fa951881..dd72f9517b 100644
--- a/testsuites/libtests/tar01/tar01.scn
+++ b/testsuites/libtests/tar01/tar01.scn
@@ -1,9 +1,24 @@
-*** TAR01 TEST ***
-Untaring from memory - successful
+*** BEGIN OF TEST TAR 1 ***
+*** TEST VERSION: 6.0.0.e1efb4eb8a9d6dd5f6f37dafc9feb0a9e6a888f1
+*** TEST STATE: EXPECTED_PASS
+*** TEST BUILD: RTEMS_POSIX_API
+*** TEST TOOLS: 10.3.1 20210409 (RTEMS 6, RSB ad54d1dd3cf8249d9d39deb1dd28b2f294df062d-modified, Newlib eb03ac1)
+Untaring from memory - untar: memory at 0x11ece8 (10240)
+untar: symlink: home/test_file -> symlink
+untar: file: home/test_file (s:73,m:0644)
+untar: file: home/abc/def/test_script (s:21,m:0755)
+untar: dir: home/dir
+untar: file: home/dir/file (s:12,m:0644)
+successful
========= /home/test_file =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
+========= /home/abc/def/test_script =========
+(0)#! joel
+ls -las /dev
+
+ /home/abc/def/test_script: mode: 0755 want: 0755
========= /symlink =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
@@ -11,35 +26,58 @@ initial tar image.
Copy tar image to test.tar
Untaring from file - successful
+Untar from file into existing structure with one missing file - successful
+Untar from file; overwrite empty directory with file - successful
+Untar from file; file exists where parent dir should be created - expected fail
+Untar from file; non-empty dir where file should be created - expected fail
+Untar from file; overwrite file with explicit directory - successful
========= /dest/home/test_file =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
+========= /dest/home/abc/def/test_script =========
+(0)#! joel
+ls -las /dev
+
+ /dest/home/abc/def/test_script: mode: 0755 want: 0755
========= /dest/symlink =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
-Untaring chunks from memory - untar: dir: home
-untar: file: home/test_file (73)
+Untaring chunks from memory - untar: symlink: home/test_file -> symlink
+untar: file: home/test_file (s:73,m:0644)
+untar: file: home/abc/def/test_script (s:21,m:0755)
+untar: dir: home/dir
+untar: file: home/dir/file (s:12,m:0644)
successful
========= /dest2/home/test_file =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
+========= /dest2/home/abc/def/test_script =========
+(0)#! joel
+ls -las /dev
+
+ /dest2/home/abc/def/test_script: mode: 0755 want: 0755
========= /dest2/symlink =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
-Untaring chunks from tgz- untar: dir: home
-untar: file: home/test_file (73)
-successful
+Untaring chunks from tgz - successful
========= /dest3/home/test_file =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
+========= /dest3/home/abc/def/test_script =========
+(0)#! joel
+ls -las /dev
+
+ /dest3/home/abc/def/test_script: mode: 0755 want: 0755
========= /dest3/symlink =========
(0)This is a test of loading an RTEMS filesystem from an
initial tar image.
-*** END OF TAR01 TEST ***
+
+
+*** END OF TEST TAR 1 ***