run revision 444a82bd6d68c6f23e05d523ff92d328f6b2ec05
#
# Run continuous integration tests.
#
# Copyright (C) 2014 Red Hat
#
# 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.
#
# 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/>.
export LC_ALL=C
. deps.sh
. misc.sh
# Minimum percentage of code lines covered by tests
# Minimum percentage of code functions covered by tests
# Output program usage information.
function usage()
{
cat <<EOF
Usage: `basename "$0"` [OPTION...]
Run continuous integration tests.
Options:
-h, --help Output this help message and exit.
-p, --prefix=STRING Use STRING as the prefix to prepend to file and
directory paths in output.
-n, --no-deps Don't attempt to install dependencies.
-e, --essential Run the essential subset of tests.
-m, --moderate Run the moderate subset of tests.
-r, --rigorous,
-f, --full Run the rigorous (full) set of tests.
Default options: --essential
EOF
}
# Output a file display path: a path relocated from base directory (BASE_DIR)
# to base prefix (BASE_PFX).
# Args: path
function disppath()
{
}
# Run a stage.
# Args: id cmd [arg...]
function stage()
{
declare end
{
printf "Start: "
set +o errexit
(
"$@"
)
status=$?
set -o errexit
printf "End: "
end=`date +%s`
printf 'success '
else
printf 'failure '
fi
printf "\n"
return "$status"
}
# Execute mock as is, or, if the user is not in the "mock" group, under sudo,
# Args: [mock_arg...]
function mock_privileged()
{
mock "$@"
else
fi
}
# Execute mock_privileged with extra chroot configuration added.
# Args: chroot [mock_arg...]
# Input: extra configuration
function mock_privileged_conf()
{
# Preserve timestamps to avoid unnecessary cache rebuilds
cat >> "${conf_dir}/${chroot}.cfg"
}
# Execute mock_privileged with dependency package source configuration added.
# Args: chroot [mock_arg...]
function mock_privileged_deps()
{
repo='fedora-$releasever-$basearch'
repo="epel-${BASH_REMATCH[1]}-\$basearch"
else
exit 1
fi
config_opts['yum.conf'] += '''
[sssd-deps]
name=Extra SSSD dependencies
skip_if_unavailable=true
gpgcheck=0
enabled=1
'''
"
}
# Run debug build checks.
function build_debug()
{
# Extended glob pattern matching tests to run under Valgrind.
# NOTE: The particular pattern below is inverted
declare -r valgrind_test_pattern="!(*.py|*/dlopen-tests|*/whitespace_test)"
export CFLAGS="$DEBUG_CFLAGS"
"${CONFIGURE_ARG_LIST[@]}" \
# Not building "tests" due to https://fedorahosted.org/sssd/ticket/2350
status=0
LOG_FLAGS="--mode=execute \
valgrind-condense 99 \
\"$valgrind_test_pattern\" -- \
--trace-children=yes \
--trace-children-skip='*/bin/*,*/sbin/*' \
--leak-check=full \
--gen-suppressions=all \
--verbose" ||
status=$?
"${CONFIGURE_ARG_LIST[@]}"
fi
# Single thread due to https://fedorahosted.org/sssd/ticket/2354
status=0
"${CONFIGURE_ARG_LIST[@]}" \
"--with-test-dir=$test_dir_distcheck"
status=$?
fi
fi
unset CFLAGS
}
# Run coverage build checks.
function build_coverage()
{
declare -r coverage_report_dir="ci-report-coverage"
# enable optimisation to avoid bug in gcc < 4.6.0
# gcc commit 7959b7e646b493f48a2ea7228fbf1c43f84bedea
# git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162384
# 138bc75d-0d04-0410-961f-82ee72b054a4
extra_CFLAGS=" -O1"
fi
export CFLAGS="$COVERAGE_CFLAGS $extra_CFLAGS"
"${CONFIGURE_ARG_LIST[@]}" \
# Build everything, including tests
# Not building "tests" due to https://fedorahosted.org/sssd/ticket/2350
# Run tests
status=$?
"$coverage_report_dir" \
--title "sssd" --show-details \
--legend --prefix "$BASE_DIR" \
ci.info |& tee ci-genhtml.out'
"coverage report:" \
"$COVERAGE_MIN_FUNCS" \
unset CFLAGS
}
# Run a build inside a sub-directory.
# Args: id cmd [arg...]
function run_build()
{
cd "$dir"
"$@"
cd ..
}
#
# Main routine
#
--longoptions help,prefix:,no-deps \
-- "$@"`
eval set -- "$args_expr"
while true; do
case "$1" in
-h|--help)
usage; exit 0;;
-p|--prefix)
DEPS=false; shift;;
-e|--essential)
-m|--moderate)
--)
shift; break;;
*)
echo "Unknown option: $1" >&2
exit 1;;
esac
done
if [ $# != 0 ]; then
echo "Positional arguments are not accepted." >&2
usage >&2
exit 1
fi
trap 'echo FAILURE' EXIT
export V=1
if "$DEPS"; then
fi
if "$RIGOROUS"; then
fi
unset V
trap - EXIT
echo SUCCESS