summaryrefslogtreecommitdiffstats
path: root/src/spdk/.githooks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/spdk/.githooks
parentInitial commit. (diff)
downloadceph-upstream/18.2.2.tar.xz
ceph-upstream/18.2.2.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/spdk/.githooks')
-rwxr-xr-xsrc/spdk/.githooks/pre-commit28
-rwxr-xr-xsrc/spdk/.githooks/pre-push81
2 files changed, 109 insertions, 0 deletions
diff --git a/src/spdk/.githooks/pre-commit b/src/spdk/.githooks/pre-commit
new file mode 100755
index 000000000..c0b461246
--- /dev/null
+++ b/src/spdk/.githooks/pre-commit
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+
+rc=0
+
+# Redirect output to stderr.
+exec 1>&2
+
+# If there are formatting errors, print the offending file names and fail.
+if [ -x "./scripts/check_format.sh" ]; then
+ echo "Running check_format.sh ..."
+ "./scripts/check_format.sh" > check_format.log 2>&1
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ cat check_format.log
+ echo ""
+ echo "ERROR check_format.sh returned errors!"
+ echo "ERROR Fix the problem and use 'git add' to update your changes."
+ echo "ERROR See `pwd`/check_format.log for more information."
+ echo ""
+ fi
+fi
+
+exit $rc
diff --git a/src/spdk/.githooks/pre-push b/src/spdk/.githooks/pre-push
new file mode 100755
index 000000000..fa9bfb928
--- /dev/null
+++ b/src/spdk/.githooks/pre-push
@@ -0,0 +1,81 @@
+#!/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
+SYSTEM=`uname -s`
+
+# Redirect output to stderr.
+exec 1>&2
+
+if [ "$SYSTEM" = "FreeBSD" ]; then
+ MAKE="gmake MAKE=gmake -j $(sysctl -a | grep -E -i 'hw.ncpu' | awk '{print $2}')"
+ COMP="clang"
+else
+ MAKE="make -j $(nproc)"
+ COMP="gcc"
+fi
+
+echo "Running make with $COMP ..."
+echo "${MAKE} clean " > make.log
+$MAKE clean >> make.log 2>&1
+
+echo "${MAKE} CONFIG_DEBUG=n CONFIG_WERROR=y " >> make.log
+$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
+
+echo "${MAKE} SKIP_DPDK_BUILD=1 clean " >> make.log
+$MAKE clean SKIP_DPDK_BUILD=1 >> make.log 2>&1
+echo "${MAKE} CONFIG_DEBUG=y CONFIG_WERROR=y SKIP_DPDK_BUILD=1 " >> make.log
+$MAKE CONFIG_DEBUG=y CONFIG_WERROR=y SKIP_DPDK_BUILD=1 >> 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
+
+echo "$MAKE clean " >> make.log
+$MAKE clean >> make.log 2>&1
+
+echo "Pushing to $1 $2"
+
+exit $rc