aboutsummaryrefslogtreecommitdiffstats
path: root/build/ci
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2019-02-12 22:29:41 +0000
committerMartin Matuska <mm@FreeBSD.org>2019-02-12 22:29:41 +0000
commitfbb1b16ad8bc7a6f9a32424ddbd61e59ad5a4d4d (patch)
tree7032f8b865acde86f00b1124822b74bdb4be73f9 /build/ci
parentc6234fa1ee365085418a23124c988baf3d02c2fd (diff)
downloadsrc-fbb1b16ad8bc7a6f9a32424ddbd61e59ad5a4d4d.tar.gz
src-fbb1b16ad8bc7a6f9a32424ddbd61e59ad5a4d4d.zip
Update vendor/libarchive/dist to git 31c0a517c91f44eeee717a04db8b075cadda83d8
Relevant vendor changes: PR #1085: Fix a null pointer dereference bug in zip writer PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2 decopmpression PR #1116: Add support for 64-bit ar format PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2] PR #1125: RAR5 reader - fix an invalid read and a memory leak PR #1131: POSIX reader - do not fail when tree_current_lstat() fails due to ENOENT [3] PR #1134: Delete unnecessary null pointer checks before calls of free() OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy. OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader PR: 233006 [3] Security: CVE-2019-1000019 [1], CVE-2019-1000020 [2]
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=344063
Diffstat (limited to 'build/ci')
-rwxr-xr-xbuild/ci/build.sh112
-rwxr-xr-xbuild/ci/cirrus_ci.sh53
-rwxr-xr-xbuild/ci/test_driver148
3 files changed, 313 insertions, 0 deletions
diff --git a/build/ci/build.sh b/build/ci/build.sh
new file mode 100755
index 000000000000..d61336eafb0e
--- /dev/null
+++ b/build/ci/build.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# Automated build and test of libarchive on CI systems
+#
+# Variables that can be passed via environment:
+# BS= # build system (autotools or cmake)
+# BUILDDIR= # build directory
+# SRCDIR= # source directory
+# CONFIGURE_ARGS= # configure arguments
+# MAKE_ARGS= # make arguments
+
+ACTIONS=
+if [ -n "${BUILD_SYSTEM}" ]; then
+ BS="${BUILD_SYSTEM}"
+fi
+BS="${BS:-autotools}"
+MAKE="${MAKE:-make}"
+CMAKE="${CMAKE:-cmake}"
+CURDIR=`pwd`
+SRCDIR="${SRCDIR:-`pwd`}"
+RET=0
+
+usage () {
+ echo "Usage: $0 [-b autotools|cmake] [-a autogen|configure|build|test ] [ -a ... ] [ -d builddir ] [-s srcdir ]"
+}
+inputerror () {
+ echo $1
+ usage
+ exit 1
+}
+while getopts a:b:d:s: opt; do
+ case ${opt} in
+ a)
+ case "${OPTARG}" in
+ autogen) ;;
+ configure) ;;
+ build) ;;
+ test) ;;
+ *) inputerror "Invalid action (-a)" ;;
+ esac
+ ACTIONS="${ACTIONS} ${OPTARG}"
+ ;;
+ b) BS="${OPTARG}"
+ case "${BS}" in
+ autotools) ;;
+ cmake) ;;
+ *) inputerror "Invalid build system (-b)" ;;
+ esac
+ ;;
+ d)
+ BUILDDIR="${OPTARG}"
+ ;;
+ s)
+ SRCDIR="${OPTARG}"
+ if [ ! -f "${SRCDIR}/build/version" ]; then
+ inputerror "Missing file: ${SRCDIR}/build/version"
+ fi
+ ;;
+ esac
+done
+if [ -z "${ACTIONS}" ]; then
+ ACTIONS="autogen configure build test"
+fi
+if [ -z "${BS}" ]; then
+ inputerror "Missing build system (-b) parameter"
+fi
+if [ -z "${BUILDDIR}" ]; then
+ BUILDDIR="${CURDIR}/build_ci/${BS}"
+fi
+mkdir -p "${BUILDDIR}"
+for action in ${ACTIONS}; do
+ cd "${BUILDDIR}"
+ case "${action}" in
+ autogen)
+ case "${BS}" in
+ autotools)
+ cd "${SRCDIR}"
+ sh build/autogen.sh
+ RET="$?"
+ ;;
+ esac
+ ;;
+ configure)
+ case "${BS}" in
+ autotools) "${SRCDIR}/configure" ${CONFIGURE_ARGS} ;;
+ cmake) ${CMAKE} ${CONFIGURE_ARGS} "${SRCDIR}" ;;
+ esac
+ RET="$?"
+ ;;
+ build)
+ ${MAKE} ${MAKE_ARGS}
+ RET="$?"
+ ;;
+ test)
+ case "${BS}" in
+ autotools)
+ ${MAKE} ${MAKE_ARGS} check LOG_DRIVER="${SRCDIR}/build/ci/test_driver"
+ ;;
+ cmake)
+ ${MAKE} ${MAKE_ARGS} test
+ ;;
+ esac
+ RET="$?"
+ find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \;
+ ;;
+ esac
+ if [ "${RET}" != "0" ]; then
+ exit "${RET}"
+ fi
+ cd "${CURDIR}"
+done
+exit "${RET}"
diff --git a/build/ci/cirrus_ci.sh b/build/ci/cirrus_ci.sh
new file mode 100755
index 000000000000..9db762f97cca
--- /dev/null
+++ b/build/ci/cirrus_ci.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+UNAME=`uname`
+if [ "$1" = "install" ]
+then
+ if [ "${UNAME}" = "FreeBSD" ]
+ then
+ set -x -e
+ sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
+ mount -u -o acls /
+ mkdir /tmp_acl_nfsv4
+ MD=`mdconfig -a -t swap -s 128M`
+ newfs /dev/$MD
+ tunefs -N enable /dev/$MD
+ mount /dev/$MD /tmp_acl_nfsv4
+ chmod 1777 /tmp_acl_nfsv4
+ pkg install -y autoconf automake cmake libiconv libtool pkgconf expat libxml2 liblz4 zstd
+ elif [ "${UNAME}" = "Darwin" ]
+ then
+ set -x -e
+ brew update
+ brew install autoconf automake libtool pkg-config cmake xz lz4 zstd
+ elif [ "${UNAME}" = "Linux" ]
+ then
+ if [ -f "/etc/debian_version" ]
+ then
+ apt-get -y update
+ apt-get -y install build-essential locales automake libtool bison sharutils pkgconf libacl1-dev libbz2-dev libzip-dev zlib1g-dev liblzma-dev liblz4-dev libzstd-dev libssl-dev lrzip cmake
+ elif [ -f "/etc/fedora-release" ]
+ then
+ dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel librichacl-devel bzip2-devel libzip-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel
+ fi
+ fi
+elif [ "$1" = "test" ]
+then
+ if [ "${UNAME}" = "FreeBSD" ]
+ then
+ set -e
+ echo "Additional NFSv4 ACL tests"
+ CURDIR=`pwd`
+ if [ "${BS}" = "cmake" ]
+ then
+ BIN_SUBDIR="bin"
+ else
+ BIN_SUBDIR=.
+ fi
+ BUILDDIR="${CURDIR}/build_ci/${BS}"
+ cd "$BUILDDIR"
+ TMPDIR=/tmp_acl_nfsv4 ${BIN_SUBDIR}/libarchive_test -r "${CURDIR}/libarchive/test" -v test_acl_platform_nfs4
+ fi
+else
+ echo "Usage $0 install | test_nfsv4_acls"
+ exit 1
+fi
diff --git a/build/ci/test_driver b/build/ci/test_driver
new file mode 100755
index 000000000000..69a5463c10e8
--- /dev/null
+++ b/build/ci/test_driver
@@ -0,0 +1,148 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2013-07-13.22; # UTC
+
+# Copyright (C) 2011-2014 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 2, 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, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error. This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+ echo "$0: $*" >&2
+ print_usage >&2
+ exit 2
+}
+
+print_usage ()
+{
+ cat <<END
+Usage:
+ test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ [--expect-failure={yes|no}] [--color-tests={yes|no}]
+ [--enable-hard-errors={yes|no}] [--]
+ TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+test_name= # Used for reporting.
+log_file= # Where to save the output of the test script.
+trs_file= # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+ case $1 in
+ --help) print_usage; exit $?;;
+ --version) echo "test-driver $scriptversion"; exit $?;;
+ --test-name) test_name=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
+ --color-tests) color_tests=$2; shift;;
+ --expect-failure) expect_failure=$2; shift;;
+ --enable-hard-errors) enable_hard_errors=$2; shift;;
+ --) shift; break;;
+ -*) usage_error "invalid option: '$1'";;
+ *) break;;
+ esac
+ shift
+done
+
+missing_opts=
+test x"$test_name" = x && missing_opts="$missing_opts --test-name"
+test x"$log_file" = x && missing_opts="$missing_opts --log-file"
+test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
+if test x"$missing_opts" != x; then
+ usage_error "the following mandatory options are missing:$missing_opts"
+fi
+
+if test $# -eq 0; then
+ usage_error "missing argument"
+fi
+
+if test $color_tests = yes; then
+ # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+ red='' # Red.
+ grn='' # Green.
+ lgn='' # Light green.
+ blu='' # Blue.
+ mgn='' # Magenta.
+ std='' # No color.
+else
+ red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+( "$@"; echo "$?" > $log_file.s ) | tee $log_file 2>&1
+estatus=`cat $log_file.s`
+
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+ tweaked_estatus=1
+else
+ tweaked_estatus=$estatus
+fi
+
+case $tweaked_estatus:$expect_failure in
+ 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+ 0:*) col=$grn res=PASS recheck=no gcopy=no;;
+ 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
+ 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
+ *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
+ *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
+esac
+
+# Report the test outcome and exit status in the logs, so that one can
+# know whether the test passed or failed simply by looking at the '.log'
+# file, without the need of also peaking into the corresponding '.trs'
+# file (automake bug#11814).
+echo "$res $test_name (exit status: $estatus)" >>$log_file
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End: