mirror of https://github.com/wolfSSL/wolfssh.git
Add pre-commit test scripts like wolfSSL.
parent
626708de86
commit
eea065727b
|
@ -26,9 +26,16 @@ if test ! -f build-aux/config.rpath; then
|
|||
touch build-aux/config.rpath
|
||||
fi
|
||||
|
||||
# Git hooks should come before autoreconf.
|
||||
if test -d .git; then
|
||||
if ! test -d .git/hooks; then
|
||||
mkdir .git/hooks
|
||||
fi
|
||||
ln -s -f ../../scripts/pre-commit.sh .git/hooks/pre-commit
|
||||
fi
|
||||
|
||||
# If this is a source checkout then call autoreconf with error as well
|
||||
if test -d .git; then
|
||||
if test -e .git; then
|
||||
WARNINGS="all,error"
|
||||
else
|
||||
WARNINGS="all"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
#commit-tests.sh
|
||||
|
||||
|
||||
# make sure current config is ok
|
||||
echo -e "\n\nTesting current config...\n\n"
|
||||
make clean; make -j 8 check;
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nCurrent config make test failed" && exit 1
|
||||
|
||||
|
||||
# make sure basic config is ok
|
||||
echo -e "\n\nTesting basic config too...\n\n"
|
||||
./configure;
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nBasic config ./configure failed" && exit 1
|
||||
|
||||
make -j 8 check;
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nBasic config make test failed" && exit 1
|
||||
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# Our "pre-commit" hook.
|
||||
|
||||
# save current config
|
||||
echo "\n\nSaving current config\n\n"
|
||||
cp config.status tmp.status
|
||||
|
||||
# stash modified files not part of this commit, don't test them
|
||||
echo "\n\nStashing any modified files not part of commit\n\n"
|
||||
git stash -q --keep-index
|
||||
|
||||
# do the commit tests
|
||||
echo "\n\nRunning commit tests...\n\n"
|
||||
./scripts/commit-tests.sh
|
||||
RESULT=$?
|
||||
|
||||
# restore modified files not part of this commit
|
||||
echo "\n\nPopping any stashed modified files not part of commit\n"
|
||||
git stash pop -q
|
||||
|
||||
# restore current config
|
||||
echo "\nRestoring current config\n"
|
||||
mv tmp.status config.status
|
||||
# don't show output incase error from above
|
||||
./config.status >/dev/null 2>&1
|
||||
make clean >/dev/null 2>&1
|
||||
make -j 8 >/dev/null 2>&1
|
||||
|
||||
[ $RESULT -ne 0 ] && echo "\nOops, your commit failed\n" && exit 1
|
||||
|
||||
echo "\nCommit tests passed!\n"
|
||||
exit 0
|
Loading…
Reference in New Issue