bug-cpio
[Top][All Lists]
Advanced

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

[PATCH] tests: add test for archive append


From: Ross Burton
Subject: [PATCH] tests: add test for archive append
Date: Fri, 3 Jan 2020 18:21:58 +0000

---
 tests/Makefile.am  |  1 +
 tests/append.at    | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/testsuite.at |  1 +
 3 files changed, 54 insertions(+)
 create mode 100644 tests/append.at

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 65bf470..09be8ed 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -44,6 +44,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
 TESTSUITE_AT = \
  testsuite.at\
  inout.at\
+ append.at\
  interdir.at\
  setstat01.at\
  setstat02.at\
diff --git a/tests/append.at b/tests/append.at
new file mode 100644
index 0000000..4c54493
--- /dev/null
+++ b/tests/append.at
@@ -0,0 +1,52 @@
+# Process this file with autom4te to create testsuite.  -*- Autotest -*-
+# Copyright (C) 2004, 2006-2007, 2010, 2014-2015, 2017 Free Software
+# Foundation, Inc.
+
+# This program 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, or (at your option)
+# any later version.
+
+# This program 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+
+AT_SETUP([basic functionality: copyin/append/copyout])
+AT_KEYWORDS([copyin copyout])
+
+AT_DATA([filelist],[a 18       
+b      1024
+])
+
+AT_CHECK([
+while read NAME LENGTH
+do
+       genfile --length $LENGTH > $NAME
+       echo $NAME
+done < filelist > filelist_raw
+
+for format in bin odc newc crc tar ustar hpbin hpodc
+do
+    head -n1 filelist_raw | cpio --format=$format --quiet -o -F archive.$format
+    tail -n1 filelist_raw | cpio --format=$format --quiet -oA -F 
archive.$format
+
+    rm -rf output
+    mkdir output && cd output
+    cpio -i --quiet < ../archive.$format
+
+    while read file
+    do
+        test -f $file || echo "$file not found"
+    done < ../filelist_raw
+
+    cd ..
+done
+])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index f901b1a..67a4af9 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -30,6 +30,7 @@ AT_TESTED([cpio])
 m4_include([version.at])
 
 m4_include([inout.at])
+m4_include([append.at])
 m4_include([symlink.at])
 m4_include([symlink-bad-length.at])
 m4_include([symlink-long.at])
-- 
2.20.1




reply via email to

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