diff options
author | Ben Brown <ben@demerara.io> | 2021-11-16 20:32:41 +0000 |
---|---|---|
committer | Ben Brown <ben@demerara.io> | 2021-11-17 18:17:06 +0000 |
commit | e4ac7f14e653c8140007bf477a18e56f991b9770 (patch) | |
tree | c9bc2c2fb3eb5bccf3a40d7045a178e478b4ae66 | |
parent | 053b70276eaacf4f20a7c3695220f2fb2ec2dc99 (diff) | |
download | lorry-e4ac7f14e653c8140007bf477a18e56f991b9770.tar.gz |
Add test for ignoring of global pax header
-rwxr-xr-x | tests/global-pax-header-ignored.script | 32 | ||||
-rwxr-xr-x | tests/global-pax-header-ignored.setup | 40 | ||||
-rw-r--r-- | tests/global-pax-header-ignored.stdout | 1 |
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/global-pax-header-ignored.script b/tests/global-pax-header-ignored.script new file mode 100755 index 0000000..31f0c52 --- /dev/null +++ b/tests/global-pax-header-ignored.script @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Tests ignoring of the global PAX header when converting tarballs. +# +# Copyright (C) 2021 Ben Brown +# +# 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; version 2 of the License. +# +# 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. + + +set -e + +logfile="${DATADIR}/tar-global-pax-header.log" +workdir="${DATADIR}/work-dir" + +"${SRCDIR}/test-lorry" \ + --pull-only \ + --log="${logfile}" \ + --working-area="${workdir}" \ + "${DATADIR}/global-pax-header.lorry" >/dev/null + +git -C "${workdir}/global-pax-header/git-a" ls-tree --name-only -r HEAD diff --git a/tests/global-pax-header-ignored.setup b/tests/global-pax-header-ignored.setup new file mode 100755 index 0000000..cc7510c --- /dev/null +++ b/tests/global-pax-header-ignored.setup @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Creates tarballs constructed with a global PAX header. +# +# Copyright (C) 2021 Ben Brown +# +# 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; version 2 of the License. +# +# 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. + + +set -e + +dir="${DATADIR}/tar-global-pax-header" +mkdir -p "${dir}" +touch "${dir}"/test + +tar_path="${DATADIR}/global-pax-header.tar" +tar --pax-option="globexthdr.name=pax_global_header" \ + --pax-option="foo=bar" \ + -C "${DATADIR}" -cf "${tar_path}" "$(basename "${dir}")" + +# create the .lorry file for the repository +cat <<EOF > "${DATADIR}/global-pax-header.lorry" +global-pax-header: + type: tarball + url: file://${tar_path} +EOF + +# create the working directory +mkdir -p "${DATADIR}/work-dir" diff --git a/tests/global-pax-header-ignored.stdout b/tests/global-pax-header-ignored.stdout new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/tests/global-pax-header-ignored.stdout @@ -0,0 +1 @@ +test |