tar: Add ptest support 49/29249/1
authorQiu Tingting <qiutt@fujitsu.com>
Thu, 28 Sep 2023 07:22:26 +0000 (07:22 +0000)
committerQiu Tingting <qiutt@fujitsu.com>
Thu, 28 Sep 2023 07:22:26 +0000 (07:22 +0000)
Add ptest support for tar.

It contains two parts.

One part is a backport for
  http://cgit.openembedded.org/openembedded-core/commit/?h=master-next&id=878e154181e5e8d18e3605f0989bebf4aec1c6e1
It should be deleted after yocto version up.

Another part is changing formate of the result of "ptest-runner tar"
Because some cases have same name, adding a case number can better
locate incorrect case.
A sample:
  PASS: tar version  -->  PASS:   1: tar version

SPEC-4753

Signed-off-by: Qiu Tingting <qiutt@fujitsu.com>
Change-Id: I878bdf1693f0e71c1ba33642cd4ff70977e125f9

meta-agl-test/recipes-external/tar/files/0001-tests-fix-TESTSUITE_AT.patch [new file with mode: 0644]
meta-agl-test/recipes-external/tar/files/0002-tests-check-for-recently-fixed-bug.patch [new file with mode: 0644]
meta-agl-test/recipes-external/tar/files/0003-Exclude-VCS-directory-with-writing-from-an-archive.patch [new file with mode: 0644]
meta-agl-test/recipes-external/tar/files/run-ptest [new file with mode: 0644]
meta-agl-test/recipes-external/tar/tar_1.34.bbappend [new file with mode: 0644]

diff --git a/meta-agl-test/recipes-external/tar/files/0001-tests-fix-TESTSUITE_AT.patch b/meta-agl-test/recipes-external/tar/files/0001-tests-fix-TESTSUITE_AT.patch
new file mode 100644 (file)
index 0000000..2b4af8d
--- /dev/null
@@ -0,0 +1,224 @@
+From 39849e9d91f477d3fb839f93cd0815d0cb3273e9 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue, 18 Jul 2023 09:15:03 -0700
+Subject: tests: fix TESTSUITE_AT
+
+Problem reported by Lukas Javorsky <ljavorsk@redhat.com> in:
+https://lists.gnu.org/r/bug-tar/2023-07/msg00002.html
+* tests/Makefile.am (TESTSUITE_AT): Add exclude17.at, exclude18.at.
+Remove compress.m4; all uses changed.  Add a comment saying how
+to rederive this.  Sort.
+
+Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/tar.git/commit/?id=39849e9d91f477d3fb839f93cd0815d0cb3273e9]
+---
+ tests/Makefile.am | 93 ++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 48 insertions(+), 45 deletions(-)
+
+diff -rNu a/tests/Makefile.am b/tests/Makefile.am
+--- a/tests/Makefile.am        2023-09-28 01:13:15.504997461 +0000
++++ b/tests/Makefile.am        2023-09-28 01:36:29.348977229 +0000
+@@ -45,21 +45,24 @@
+ ## Test suite.  ##
+ ## ------------ ##
++# You can generate the body of this macro with the following shell command:
++# LC_ALL=C ls *.at */*.at | sed -e 's/^/ /' -e '$!s/$/\\/'
+ TESTSUITE_AT = \
+- testsuite.at\
+- compress.m4\
+  T-cd.at\
+  T-dir00.at\
+  T-dir01.at\
+  T-empty.at\
++ T-mult.at\
++ T-nest.at\
++ T-nonl.at\
+  T-null.at\
+  T-null2.at\
+  T-rec.at\
+  T-recurse.at\
+  T-zfile.at\
+- T-nonl.at\
+- T-mult.at\
+- T-nest.at\
++ acls01.at\
++ acls02.at\
++ acls03.at\
+  add-file.at\
+  append.at\
+  append01.at\
+@@ -68,20 +71,23 @@
+  append04.at\
+  append05.at\
+  backup01.at\
+- chtype.at\
+- comprec.at\
+- comperr.at\
++ capabs_raw01.at\
+  checkpoint/defaults.at\
+- checkpoint/interval.at\
+- checkpoint/dot.at\
+  checkpoint/dot-compat.at\
+  checkpoint/dot-int.at\
++ checkpoint/dot.at\
++ checkpoint/interval.at\
++ chtype.at\
++ comperr.at\
++ comprec.at\
+  delete01.at\
+  delete02.at\
+  delete03.at\
+  delete04.at\
+  delete05.at\
+  difflink.at\
++ dirrem01.at\
++ dirrem02.at\
+  exclude.at\
+  exclude01.at\
+  exclude02.at\
+@@ -99,6 +105,8 @@
+  exclude14.at\
+  exclude15.at\
+  exclude16.at\
++ exclude17.at\
++ exclude18.at\
+  extrac01.at\
+  extrac02.at\
+  extrac03.at\
+@@ -125,11 +133,9 @@
+  extrac24.at\
+  filerem01.at\
+  filerem02.at\
+- dirrem01.at\
+- dirrem02.at\
+- gzip.at\
+  grow.at\
+- incremental.at\
++ gzip.at\
++ ignfail.at\
+  incr01.at\
+  incr02.at\
+  incr03.at\
+@@ -141,8 +147,8 @@
+  incr09.at\
+  incr10.at\
+  incr11.at\
++ incremental.at\
+  indexfile.at\
+- ignfail.at\
+  label01.at\
+  label02.at\
+  label03.at\
+@@ -186,22 +192,16 @@
+  opcomp04.at\
+  opcomp05.at\
+  opcomp06.at\
+- positional01.at\
+- positional02.at\
+- positional03.at\
+  options.at\
+  options02.at\
+  options03.at\
+  owner.at\
+  pipe.at\
+- recurse.at\
++ positional01.at\
++ positional02.at\
++ positional03.at\
+  recurs02.at\
+- rename01.at\
+- rename02.at\
+- rename03.at\
+- rename04.at\
+- rename05.at\
+- rename06.at\
++ recurse.at\
+  remfiles01.at\
+  remfiles02.at\
+  remfiles03.at\
+@@ -224,11 +224,19 @@
+  remfiles09b.at\
+  remfiles09c.at\
+  remfiles10.at\
++ rename01.at\
++ rename02.at\
++ rename03.at\
++ rename04.at\
++ rename05.at\
++ rename06.at\
+  same-order01.at\
+  same-order02.at\
++ selacl01.at\
++ selnx01.at\
+  shortfile.at\
+- shortupd.at\
+  shortrec.at\
++ shortupd.at\
+  sigpipe.at\
+  sparse01.at\
+  sparse02.at\
+@@ -245,6 +253,13 @@
+  sptrcreat.at\
+  sptrdiff00.at\
+  sptrdiff01.at\
++ star/gtarfail.at\
++ star/gtarfail2.at\
++ star/multi-fail.at\
++ star/pax-big-10g.at\
++ star/ustar-big-2g.at\
++ star/ustar-big-8g.at\
++ testsuite.at\
+  time01.at\
+  time02.at\
+  truncate.at\
+@@ -252,21 +267,11 @@
+  update01.at\
+  update02.at\
+  update03.at\
+- volsize.at\
+- volume.at\
+  verbose.at\
+  verify.at\
+  version.at\
+- xform-h.at\
+- xform01.at\
+- xform02.at\
+- xform03.at\
+- star/gtarfail.at\
+- star/gtarfail2.at\
+- star/multi-fail.at\
+- star/ustar-big-2g.at\
+- star/ustar-big-8g.at\
+- star/pax-big-10g.at\
++ volsize.at\
++ volume.at\
+  xattr01.at\
+  xattr02.at\
+  xattr03.at\
+@@ -274,12 +279,11 @@
+  xattr05.at\
+  xattr06.at\
+  xattr07.at\
+- acls01.at\
+- acls02.at\
+- acls03.at\
+- selnx01.at\
+- selacl01.at\
+- capabs_raw01.at
++ xform-h.at\
++ xform01.at\
++ xform02.at\
++ xform03.at
++
+ distclean-local:
+       -rm -rf download
+@@ -287,7 +291,7 @@
+ TESTSUITE = $(srcdir)/testsuite
+ AUTOTEST = $(AUTOM4TE) --language=autotest
+-$(TESTSUITE): package.m4 $(TESTSUITE_AT)
++$(TESTSUITE): compress.m4 package.m4 $(TESTSUITE_AT)
+       $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+       mv $@.tmp $@
diff --git a/meta-agl-test/recipes-external/tar/files/0002-tests-check-for-recently-fixed-bug.patch b/meta-agl-test/recipes-external/tar/files/0002-tests-check-for-recently-fixed-bug.patch
new file mode 100644 (file)
index 0000000..5b9a0c6
--- /dev/null
@@ -0,0 +1,54 @@
+tests: check for recently-fixed bug
+
+* tests/exclude17.at: New file.
+
+Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/tar.git/commit/?id=0f0722df45ec520d0dac7c9ad7e69165e9140931]
+---
+ tests/exclude17.at | 35 +++++++++++++++++++++++++++++++++++
+ 1 files changed, 35 insertions(+)
+ create mode 100644 tests/exclude17.at
+
+diff --git a/tests/exclude17.at b/tests/exclude17.at
+new file mode 100644
+index 0000000..4162b2b
+--- /dev/null
++++ b/tests/exclude17.at
+@@ -0,0 +1,35 @@
++# Process this file with autom4te to create testsuite. -*- Autotest -*-
++#
++# Test suite for GNU tar.
++# Copyright 2013-2022 Free Software Foundation, Inc.
++
++# This file is part of GNU tar.
++
++# 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/>.
++
++AT_SETUP([--exclude-vcs-ignores memory allocation])
++AT_KEYWORDS([exclude exclude17])
++
++AT_TAR_CHECK([
++mkdir dir
++cd dir
++echo '*.o' >.cvsignore
++tar -cf - --exclude-vcs-ignores . | tar -tf -
++],
++[0],
++[./
++./.cvsignore
++])
++
++AT_CLEANUP
+-- 
+cgit v1.1
+
diff --git a/meta-agl-test/recipes-external/tar/files/0003-Exclude-VCS-directory-with-writing-from-an-archive.patch b/meta-agl-test/recipes-external/tar/files/0003-Exclude-VCS-directory-with-writing-from-an-archive.patch
new file mode 100644 (file)
index 0000000..986c4ef
--- /dev/null
@@ -0,0 +1,106 @@
+tests: Exclude VCS directory with writing from an archive
+
+See https://savannah.gnu.org/bugs/?62859
+
+Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/tar.git/commit/?id=4f814e0e4c673f86dc65a557f7e55f6b5efd1529]
+---
+ tests/exclude18.at | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 87 insertions(+)
+ create mode 100644 tests/exclude18.at
+
+diff --git a/tests/exclude18.at b/tests/exclude18.at
+new file mode 100644
+index 0000000..64aaa52
+--- /dev/null
++++ b/tests/exclude18.at
+@@ -0,0 +1,87 @@
++# Process this file with autom4te to create testsuite. -*- Autotest -*-
++
++# Test suite for GNU tar.
++# Copyright 2004-2023 Free Software Foundation, Inc.
++
++# This file is part of GNU tar.
++
++# 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/>.
++
++# Test --exclude-vcs option with subcommands: EXTRACT, LIST, DIFF.
++# Check VCS directory with files, and empty.
++#
++# Ref: https://savannah.gnu.org/bugs/?62859
++# Wed 03 Aug 2022 04:06:28 PM UTC, original submission:  Quote
++# Mohamed Akram <mohdakram>
++# > The --exclude-vcs flag seems to exclude .gitignore but not .git when
++# extracting.
++
++AT_SETUP([--exclude-vcs extract list compare])
++AT_KEYWORDS([exclude-vcs extract list compare exclude18])
++
++AT_TAR_CHECK([
++AT_SORT_PREREQ
++mkdir gitrepo
++cd gitrepo
++
++# Make an empty VCS directory:
++mkdir .svn
++
++# Make a VCS directory with a file:
++mkdir .git
++touch .git/_A
++
++# Make a VCS file:
++touch .gitignore
++
++# Make non-VCS files:
++touch .git_B
++touch _C
++
++# Create an archive, include VCS:
++cd ..
++tar -cf gitrepo.tar gitrepo
++rm -r gitrepo
++
++echo Extract:
++tar -xvf gitrepo.tar --exclude-vcs | sort
++
++echo
++echo List:
++tar -tf gitrepo.tar --exclude-vcs | sort
++
++echo
++echo Diff:
++tar -dvf gitrepo.tar --exclude-vcs gitrepo | sort
++
++],
++[0],
++[Extract:
++gitrepo/
++gitrepo/.git_B
++gitrepo/_C
++
++List:
++gitrepo/
++gitrepo/.git_B
++gitrepo/_C
++
++Diff:
++gitrepo/
++gitrepo/.git_B
++gitrepo/_C
++],
++[])
++
++AT_CLEANUP
+-- 
+cgit v1.1
+
diff --git a/meta-agl-test/recipes-external/tar/files/run-ptest b/meta-agl-test/recipes-external/tar/files/run-ptest
new file mode 100644 (file)
index 0000000..185b33d
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Define tar test work dir
+WORKDIR=@PTEST_PATH@/tests/
+
+# Run test
+cd ${WORKDIR}
+./atconfig ./atlocal ./testsuite
+
+# clear log
+rm -rf testsuite.dir
+rm -rf testsuite.log
+
+./testsuite --am-fmt
diff --git a/meta-agl-test/recipes-external/tar/tar_1.34.bbappend b/meta-agl-test/recipes-external/tar/tar_1.34.bbappend
new file mode 100644 (file)
index 0000000..0fcd829
--- /dev/null
@@ -0,0 +1,44 @@
+# Add ptest support
+
+# backport of yocto begin
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+# add for ptest support
+SRC_URI += " \
+    file://run-ptest \
+    file://0001-tests-fix-TESTSUITE_AT.patch \
+    file://0002-tests-check-for-recently-fixed-bug.patch \
+    file://0003-Exclude-VCS-directory-with-writing-from-an-archive.patch \
+"
+
+inherit ptest
+
+do_compile_ptest() {
+    oe_runmake -C ${B}/gnu/ check
+    oe_runmake -C ${B}/lib/ check
+    oe_runmake -C ${B}/rmt/ check
+    oe_runmake -C ${B}/src/ check
+    rm -rf ${S}/tests/testsuite
+    oe_runmake -C ${B}/tests/ testsuite
+    oe_runmake -C ${B}/tests/ genfile checkseekhole ckmtime
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
+    sed -i "/abs_/d" ${D}${PTEST_PATH}/tests/atconfig
+    echo "abs_builddir=${PTEST_PATH}/tests/" >> ${D}${PTEST_PATH}/tests/atconfig
+    install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/
+    sed -i "/PATH=/d" ${D}${PTEST_PATH}/tests/atlocal
+    install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/checkseekhole ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/ckmtime ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
+    sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest
+}
+# backport of yocto end
+
+# add for agl-test-framework
+do_install_ptest:append() {
+    sed -i "s/\$at_am_msg: \$at_desc/\$at_am_msg: \$at_desc_line/g" ${D}${PTEST_PATH}/tests/testsuite
+}