From: Loic Dachary Date: Sat, 6 Dec 2014 22:59:54 +0000 (+0100) Subject: documentation: simplify running make check X-Git-Tag: v0.91~47^2~24^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9ddf97a0c917179e30d4d7bf5fff282c33a60d9;p=ceph.git documentation: simplify running make check Encapsulate the compilation steps (install dependencies, autogen.sh, configure, make check) in the run-make-check.sh script. Update the developer documentation to point to this script instead of multiple steps. It is intended as a tool to help new developer make sure their patch is sane, it focuses on efficiency (runs make check in parallel if possible) and coverage (enables docker based tests if possible). http://tracker.ceph.com/issues/10265 Fixes: #10265 Signed-off-by: Loic Dachary --- diff --git a/SubmittingPatches b/SubmittingPatches index 5802c876156f..45fe21f06874 100644 --- a/SubmittingPatches +++ b/SubmittingPatches @@ -233,7 +233,7 @@ allows you to submit pull requests directly from the command line: $ hub pull-request -b ceph:master -h you:mything -Pull rqeuests appear in the review queue at +Pull requests appear in the review queue at https://github.com/organizations/ceph/dashboard/pulls diff --git a/doc/dev/quick_guide.rst b/doc/dev/quick_guide.rst index c23f56a8ffd6..07d8a8b3e520 100644 --- a/doc/dev/quick_guide.rst +++ b/doc/dev/quick_guide.rst @@ -7,19 +7,14 @@ This guide will describe how to build and test Ceph for development. Development ----------- -After installing the dependencies described in the ``README``, -prepare the git source tree by updating the submodules +The ``run-make-check.sh`` script will install Ceph dependencies, +compiles everything in debug mode and runs a number of tests to verify +the result behaves as expected. .. code:: - git submodule update --init + $ ./run-make-check.sh -To build the server daemons, and FUSE client, execute the following: - -.. code:: - - ./do_autogen.sh -d 1 - make -j [number of cpus] Running a development deployment -------------------------------- diff --git a/run-make-check.sh b/run-make-check.sh new file mode 100755 index 000000000000..2884cbf09875 --- /dev/null +++ b/run-make-check.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# Ceph distributed storage system +# +# Copyright (C) 2014 Red Hat +# +# Author: Loic Dachary +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# + +# +# Return true if the working tree is after the commit that made +# make -j8 check possible +# +function can_parallel_make_check() { + local commit=$(git rev-parse tags/v0.88^{}) + git rev-list HEAD | grep --quiet $commit +} + +function maybe_parallel_make_check() { + if can_parallel_make_check ; then + echo -j$(get_processors) + fi +} +# +# Return MAX(1, (number of processors / 2)) by default or NPROC +# +function get_processors() { + if test -n "$NPROC" ; then + echo $NPROC + else + local processors=$(grep -c '^processor' /proc/cpuinfo) + if test $processors -ge 2 ; then + expr $processors / 2 + else + echo 1 + fi + fi +} + +# +# Return true if the working tree is after the commit that +# enabled docker based tests +# +function maybe_enable_docker() { + local commit=e038b1266b8d427308ab9e498d93a47bd8e3053a + if git rev-list HEAD | grep --quiet $commit ; then + echo --enable-docker + fi +} + +function run() { + sudo $(which apt-get yum zypper 2>/dev/null) install ccache + sudo modprobe rbd + + if test -f ./install-deps.sh ; then + $DRY_RUN ./install-deps.sh || return 1 + fi + $DRY_RUN ./autogen.sh || return 1 + $DRY_RUN ./configure $(maybe_enable_docker) --disable-static --with-radosgw --with-debug \ + CC="ccache gcc" CXX="ccache g++" CFLAGS="-Wall -g" CXXFLAGS="-Wall -g" || return 1 + $DRY_RUN make -j$(get_processors) || return 1 + $DRY_RUN make $(maybe_parallel_make_check) check || return 1 + $DRY_RUN make dist || return 1 +} + +function main() { + if run ; then + echo "make check: successful run on $(git rev-parse HEAD)" + return 0 + else + find . -name '*.trs' | xargs grep -l FAIL | while read file ; do + log=$(dirname $file)/$(basename $file .trs).log + echo FAIL: $log + cat $log + done + return 1 + fi +} + +main