]>
git.proxmox.com Git - ceph.git/blob - ceph/run-make-check.sh
3 # Ceph distributed storage system
5 # Copyright (C) 2014 Red Hat <contact@redhat.com>
7 # Author: Loic Dachary <loic@dachary.org>
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
16 # Return MAX(1, (number of processors / 2)) by default or NPROC
18 function get_processors
() {
19 if test -n "$NPROC" ; then
22 if test $
(nproc
) -ge 2 ; then
32 if test -f /etc
/redhat-release
; then
33 source /etc
/os-release
34 if ! type bc > /dev
/null
2>&1 ; then
35 echo "Please install bc and re-run."
38 if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
39 install_cmd
="dnf -y install"
41 install_cmd
="yum install -y"
45 type apt-get
> /dev
/null
2>&1 && install_cmd
="apt-get install -y"
46 type zypper
> /dev
/null
2>&1 && install_cmd
="zypper --gpg-auto-import-keys --non-interactive install"
48 if ! type sudo
> /dev
/null
2>&1 ; then
49 echo "Please install sudo and re-run. This script assumes it is running"
50 echo "as a normal user with the ability to run commands as root via sudo."
53 if [ -n "$install_cmd" ]; then
54 $DRY_RUN sudo
$install_cmd ccache jq
56 echo "WARNING: Don't know how to install packages" >&2
59 if test -f .
/install-deps.sh
; then
60 $DRY_RUN .
/install-deps.sh ||
return 1
63 # Init defaults after deps are installed. get_processors() depends on coreutils nproc.
64 DEFAULT_MAKEOPTS
=${DEFAULT_MAKEOPTS:--j$(get_processors)}
65 BUILD_MAKEOPTS
=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS}
66 CHECK_MAKEOPTS
=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
68 $DRY_RUN .
/do_cmake.sh $@ ||
return 1
70 $DRY_RUN make $BUILD_MAKEOPTS tests ||
return 1
71 $DRY_RUN ctest
$CHECK_MAKEOPTS --output-on-failure ||
return 1
75 if [[ $EUID -eq 0 ]] ; then
76 echo "For best results, run this script as a normal user configured"
77 echo "with the ability to run commands as root via sudo."
79 echo -n "Checking hostname sanity... "
80 if hostname
--fqdn >/dev
/null
2>&1 ; then
84 echo "Please fix 'hostname --fqdn', otherwise 'make check' will fail"
88 rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv
*
89 echo "cmake check: successful run on $(git rev-parse HEAD)"
92 rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv
*