bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] add test for --offset


From: Matteo Croce
Subject: [PATCH 2/2] add test for --offset
Date: Thu, 24 Oct 2024 17:25:43 +0200

From: Matteo Croce <teknoraver@meta.com>

Add an unit test for the --offset option
---
 tests/offset.at    | 53 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/testsuite.at |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 tests/offset.at

diff --git a/tests/offset.at b/tests/offset.at
new file mode 100644
index 00000000..56fef7c9
--- /dev/null
+++ b/tests/offset.at
@@ -0,0 +1,53 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Test suite for GNU tar.
+# Copyright 2013-2024 Free Software Foundation, Inc.
+#
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Description: ensure tar can create an archive which is not
+# at the beginning of the file with --offset option.
+#
+
+AT_SETUP([offset extract])
+AT_KEYWORDS([extract offset archive])
+
+AT_TAR_CHECK([
+AT_SORT_PREREQ
+mkdir dir
+: > dir/0k
+dd status=none if=/dev/zero of=dir/3k bs=1k count=3
+dd status=none if=/dev/zero of=dir/5k bs=1k count=5
+dd status=none if=/dev/zero of=dir/9k bs=1k count=9
+( dd status=none if=/dev/zero bs=4k count=1 ; tar -c --sort=name dir ) >foo.tar
+ls foo.tar
+
+# test both seekable and not seekable input
+tar xvf foo.tar --offset=4096
+cat foo.tar |tar xv --offset=4096
+],
+[0],
+[foo.tar
+dir/
+dir/0k
+dir/3k
+dir/5k
+dir/9k
+dir/
+dir/0k
+dir/3k
+dir/5k
+dir/9k
+],[],[],[],[gnu])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 33227ef4..1713bb99 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -354,6 +354,7 @@ m4_include([extrac24.at])
 m4_include([extrac25.at])
 m4_include([extrac26.at])
 m4_include([extrac27.at])
+m4_include([offset.at])
 
 m4_include([backup01.at])
 
-- 
2.46.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]