2018-02-05 18:15:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Verify what is about to be pushed. Called by "git
|
|
|
|
# push" after it has checked the remote status, but before anything has been
|
|
|
|
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
|
|
|
#
|
|
|
|
# This hook is called with the following parameters:
|
|
|
|
#
|
|
|
|
# $1 -- Name of the remote to which the push is being done
|
|
|
|
# $2 -- URL to which the push is being done
|
|
|
|
#
|
|
|
|
# If pushing without using a named remote those arguments will be equal.
|
|
|
|
|
|
|
|
# <local ref> <local sha1> <remote ref> <remote sha1>
|
|
|
|
#
|
|
|
|
|
|
|
|
rc=0
|
2018-06-21 20:12:24 +00:00
|
|
|
SYSTEM=`uname -s`
|
2018-02-05 18:15:54 +00:00
|
|
|
|
|
|
|
# Redirect output to stderr.
|
|
|
|
exec 1>&2
|
|
|
|
|
2018-06-21 20:12:24 +00:00
|
|
|
if [ "$SYSTEM" = "FreeBSD" ]; then
|
|
|
|
MAKE="gmake MAKE=gmake -j ${nproc}"
|
|
|
|
COMP="clang"
|
|
|
|
else
|
|
|
|
MAKE="make -j ${nproc}"
|
|
|
|
COMP="gcc"
|
|
|
|
fi
|
2018-02-05 18:15:54 +00:00
|
|
|
|
2018-06-21 20:12:24 +00:00
|
|
|
echo "Running make with $COMP ..."
|
|
|
|
echo "${MAKE} clean " > make.log
|
2018-02-05 18:15:54 +00:00
|
|
|
$MAKE clean >> make.log 2>&1
|
2018-06-21 20:12:24 +00:00
|
|
|
echo "${MAKE} CONFIG_DEBUG=n CONFIG_WERROR=y " >> make.log
|
2018-02-05 18:15:54 +00:00
|
|
|
$MAKE CONFIG_DEBUG=n CONFIG_WERROR=y >> make.log 2>&1
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -ne 0 ]; then
|
|
|
|
tail -20 make.log
|
|
|
|
echo ""
|
|
|
|
echo "ERROR make returned errors!"
|
|
|
|
echo "ERROR Fix the problem and use 'git commit' to update your changes."
|
|
|
|
echo "ERROR See `pwd`/make.log for more information."
|
|
|
|
echo ""
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
2018-06-21 20:12:24 +00:00
|
|
|
echo "${MAKE} clean " >> make.log
|
2018-02-05 18:15:54 +00:00
|
|
|
$MAKE clean >> make.log 2>&1
|
2018-06-21 20:12:24 +00:00
|
|
|
echo "${MAKE} CONFIG_DEBUG=y CONFIG_WERROR=y " >> make.log
|
2018-02-05 18:15:54 +00:00
|
|
|
$MAKE CONFIG_DEBUG=y CONFIG_WERROR=y >> make.log 2>&1
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -ne 0 ]; then
|
|
|
|
tail -20 make.log
|
|
|
|
echo ""
|
|
|
|
echo "ERROR make returned errors!"
|
|
|
|
echo "ERROR Fix the problem and use 'git commit' to update your changes."
|
|
|
|
echo "ERROR See `pwd`/make.log for more information."
|
|
|
|
echo ""
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Running unittest.sh ..."
|
|
|
|
echo "./test/unit/unittest.sh" >> make.log
|
|
|
|
"./test/unit/unittest.sh" >> make.log 2>&1
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -ne 0 ]; then
|
|
|
|
tail -20 make.log
|
|
|
|
echo ""
|
|
|
|
echo "ERROR unittest returned errors!"
|
|
|
|
echo "ERROR Fix the problem and use 'git commit' to update your changes."
|
|
|
|
echo "ERROR See `pwd`/make.log for more information."
|
|
|
|
echo ""
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
2018-06-21 20:12:24 +00:00
|
|
|
echo "$MAKE clean " >> make.log
|
2018-02-05 18:15:54 +00:00
|
|
|
$MAKE clean >> make.log 2>&1
|
|
|
|
|
2018-06-21 20:12:24 +00:00
|
|
|
if [ "$SYSTEM" = "FreeBSD" ]; then
|
|
|
|
echo
|
|
|
|
echo "Pushing to $1 $2"
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
2018-02-05 18:15:54 +00:00
|
|
|
if ! hash clang 2>/dev/null; then
|
|
|
|
echo "clang not found; skipping the clang tests"
|
|
|
|
echo
|
|
|
|
echo "Pushing to $1 $2"
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Running make with clang ..."
|
|
|
|
echo "make CONFIG_DEBUG=n CONFIG_WERROR=y CC=clang CXX=clang++ " >> make.log
|
|
|
|
$MAKE CONFIG_DEBUG=n CONFIG_WERROR=y CC=clang CXX=clang++ >> make.log 2>&1
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -ne 0 ]; then
|
|
|
|
tail -20 make.log
|
|
|
|
echo ""
|
|
|
|
echo "ERROR make CC=clang CXX=clang++ returned errors!"
|
|
|
|
echo "ERROR Fix the problem and use 'git commit' to update your changes."
|
|
|
|
echo "ERROR See `pwd`/make.log for more information."
|
|
|
|
echo ""
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "make clean CC=clang CXX=clang++ " >> make.log
|
|
|
|
$MAKE clean CC=clang CXX=clang++ >> make.log 2>&1
|
|
|
|
echo "make CONFIG_DEBUG=y CONFIG_WERROR=y CC=clang CXX=clang++ " >> make.log
|
|
|
|
$MAKE CONFIG_DEBUG=y CONFIG_WERROR=y CC=clang CXX=clang++ >> make.log 2>&1
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -ne 0 ]; then
|
|
|
|
tail -20 make.log
|
|
|
|
echo ""
|
|
|
|
echo "ERROR make CC=clang CXX=clang++ returned errors!"
|
|
|
|
echo "ERROR Fix the problem and use 'git commit' to update your changes."
|
|
|
|
echo "ERROR See `pwd`/make.log for more information."
|
|
|
|
echo ""
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Running unittest.sh ..."
|
|
|
|
echo "./test/unit/unittest.sh" >> make.log
|
|
|
|
"./test/unit/unittest.sh" >> make.log 2>&1
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -ne 0 ]; then
|
|
|
|
tail -20 make.log
|
|
|
|
echo ""
|
|
|
|
echo "ERROR unittest returned errors!"
|
|
|
|
echo "ERROR Fix the problem and use 'git commit' to update your changes."
|
|
|
|
echo "ERROR See `pwd`/make.log for more information."
|
|
|
|
echo ""
|
|
|
|
exit $rc
|
|
|
|
fi
|
|
|
|
|
2018-06-21 20:12:24 +00:00
|
|
|
${MAKE} clean CC=clang CXX=clang++ 2> /dev/null
|
2018-02-05 18:15:54 +00:00
|
|
|
|
|
|
|
echo "Pushing to $1 $2"
|
|
|
|
|
|
|
|
exit $rc
|