run revision 8d1b572126afceb60693ff4c4a734bd6dbdaf548
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# Run continuous integration tests.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# Copyright (C) 2014 Red Hat
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# This program is free software; you can redistribute it and/or modify
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# it under the terms of the GNU General Public License as published by
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# the Free Software Foundation; either version 3 of the License, or
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# (at your option) any later version.
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# This program is distributed in the hope that it will be useful,
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# but WITHOUT ANY WARRANTY; without even the implied warranty of
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews# GNU General Public License for more details.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You should have received a copy of the GNU General Public License
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# along with this program. If not, see <http://www.gnu.org/licenses/>.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userdeclare -r CI_DIR=`dirname "\`readlink -f \"\$0\"\`"`
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userdeclare -r COVERAGE_CFLAGS="-g3 -O0 --coverage"
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userdeclare -r CPU_NUM=`getconf _NPROCESSORS_ONLN`
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Minimum percentage of code lines covered by tests
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Minimum percentage of code functions covered by tests
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Output program usage information.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinUsage: `basename "$0"` [OPTION...]
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox UserRun continuous integration tests.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -h, --help Output this help message and exit.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -p, --prefix=STRING Use STRING as the prefix to prepend to file and
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein directory paths in output.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User -n, --no-deps Don't attempt to install dependencies.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -e, --essential Run the essential subset of tests.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -m, --moderate Run the moderate subset of tests.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -r, --rigorous,
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User -f, --full Run the rigorous (full) set of tests.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinDefault options: --essential
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Output a file display path: a path relocated from base directory (BASE_DIR)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# to base prefix (BASE_PFX).
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User printf "%s" "$BASE_PFX${path:${#BASE_DIR}+1}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Run a stage.
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User# Args: id cmd [arg...]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Execute mock as is, or, if the user is not in the "mock" group, under sudo,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# which has password prompt/input on the console, instead of stderr/stdin.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Args: [mock_arg...]
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User prompt+="To run mock enter sudo password for $USER: "
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Execute mock_privileged with extra chroot configuration added.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Args: chroot [mock_arg...]
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Input: extra configuration
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein conf_dir=`mktemp --tmpdir --directory mock-config.XXXXXXXX`
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Preserve timestamps to avoid unnecessary cache rebuilds
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein cp -r --preserve=timestamps /etc/mock/* "$conf_dir"/
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein touch --reference="/etc/mock/${chroot}.cfg" "${conf_dir}/${chroot}.cfg"
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User mock_privileged --configdir="$conf_dir" --root="$chroot" "$@"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Execute mock_privileged with dependency package source configuration added.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Args: chroot [mock_arg...]
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User declare -r config=$(basename $(readlink -f "/etc/mock/${chroot_name}.cfg"))
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinconfig_opts['yum.conf'] += '''
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Username=Extra SSSD dependencies
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinbaseurl=http://copr-be.cloud.fedoraproject.org/results/lslebodn/sssd-deps/$repo/
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userskip_if_unavailable=true
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Run debug build checks.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # Extended glob pattern matching tests to run under Valgrind.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # NOTE: The particular pattern below is inverted
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein declare -r valgrind_test_pattern="!(*.py|*/dlopen-tests|*/whitespace_test)"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein test_dir=`mktemp --directory /dev/shm/ci-test-dir.XXXXXXXX`
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User # Not building "tests" due to https://fedorahosted.org/sssd/ticket/2350
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User stage make-tests make-check-wrap -j $CPU_NUM check -- true
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein stage make-intgcheck make -j $CPU_NUM intgcheck \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein test_dir_distcheck=`mktemp --directory /dev/shm/ci-test-dir.XXXXXXXX`
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Single thread due to https://fedorahosted.org/sssd/ticket/2354
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User stage mock-build mock_privileged_deps "default" \
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson# Run coverage build checks.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User declare -r coverage_report_dir="ci-report-coverage"
status=$?
ci.info |& tee ci-genhtml.out'
unset CFLAGS
--longoptions help,prefix:,no-deps \
eval set -- "$args_expr"
-h|--help)
-p|--prefix)
DEPS=false; shift;;
-e|--essential)
-m|--moderate)
if "$DEPS"; then
if "$RIGOROUS"; then
trap - EXIT
echo SUCCESS