mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-09-21 13:19:03 +00:00
start test framework
This commit is contained in:
parent
41b8e6918d
commit
f53b8df40f
1
JSON.sh
1
JSON.sh
@ -1 +0,0 @@
|
|||||||
Subproject commit 022ec337c3225d5857856fd924cef0ab20443088
|
|
@ -102,4 +102,4 @@ Bashbot is not more (in)secure as any other Bot written in any other language, w
|
|||||||
|
|
||||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-0-g3b17bc2
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
@ -166,5 +166,5 @@ That's it!
|
|||||||
If you feel that there's something missing or if you found a bug, feel
|
If you feel that there's something missing or if you found a bug, feel
|
||||||
free to submit a pull request!
|
free to submit a pull request!
|
||||||
|
|
||||||
latexmath:[\[VERSION\]] v0.61-0-g3b17bc2
|
latexmath:[\[VERSION\]] 0.70-dev-11-g41b8e69
|
||||||
++++++++++++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# description: Start or stop telegram-bash-bot
|
# description: Start or stop telegram-bash-bot
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.61-0-g3b17bc2
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
# shellcheck disable=SC2009
|
# shellcheck disable=SC2009
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
|
|
||||||
|
23
bashbot.sh
23
bashbot.sh
@ -10,7 +10,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.61-0-g3b17bc2
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -44,9 +44,9 @@ if [ ! -w "." ]; then
|
|||||||
ls -ld .
|
ls -ld .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TOKEN="./token"
|
TOKENFILE="./token"
|
||||||
if [ ! -f "${TOKEN}" ]; then
|
if [ ! -f "${TOKENFILE}" ]; then
|
||||||
if [ "${CLEAR}" = "" ]; then
|
if [ "${CLEAR}" = "" ] && [ "$1" != "init" ]; then
|
||||||
echo "Running headless, run ${SCRIPT} init first!"
|
echo "Running headless, run ${SCRIPT} init first!"
|
||||||
exit 2
|
exit 2
|
||||||
else
|
else
|
||||||
@ -54,13 +54,13 @@ if [ ! -f "${TOKEN}" ]; then
|
|||||||
echo -e "${RED}TOKEN MISSING.${NC}"
|
echo -e "${RED}TOKEN MISSING.${NC}"
|
||||||
echo -e "${ORANGE}PLEASE WRITE YOUR TOKEN HERE OR PRESS CTRL+C TO ABORT${NC}"
|
echo -e "${ORANGE}PLEASE WRITE YOUR TOKEN HERE OR PRESS CTRL+C TO ABORT${NC}"
|
||||||
read -r token
|
read -r token
|
||||||
echo "${token}" > "${TOKEN}"
|
echo "${token}" > "${TOKENFILE}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "JSON.sh/JSON.sh" ]; then
|
if [ ! -f "JSON.sh/JSON.sh" ]; then
|
||||||
echo "You did not clone recursively! Downloading JSON.sh..."
|
echo "Seems to be first run, Downloading JSON.sh..."
|
||||||
git clone http://github.com/dominictarr/JSON.sh
|
git clone https://github.com/dominictarr/JSON.sh/ 2>&1
|
||||||
echo "JSON.sh has been downloaded. Proceeding."
|
echo "JSON.sh has been downloaded. Proceeding."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -603,9 +603,13 @@ getBotName() {
|
|||||||
|
|
||||||
ME="$(getBotName)"
|
ME="$(getBotName)"
|
||||||
if [ "$ME" = "" ]; then
|
if [ "$ME" = "" ]; then
|
||||||
|
if [ "$(cat "${TOKENFILE}")" = "bashbottestscript" ]; then
|
||||||
|
ME="bashbottestscript"
|
||||||
|
else
|
||||||
echo -e "${RED}ERROR: Can't connect to Telegram Bot! May be your TOKEN is invalid ...${NC}"
|
echo -e "${RED}ERROR: Can't connect to Telegram Bot! May be your TOKEN is invalid ...${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# use phyton JSON to decode JSON UFT-8, provide bash implementaion as fallback
|
# use phyton JSON to decode JSON UFT-8, provide bash implementaion as fallback
|
||||||
if which python >/dev/null 2>&1 || which phyton2 >/dev/null 2>&1; then
|
if which python >/dev/null 2>&1 || which phyton2 >/dev/null 2>&1; then
|
||||||
@ -687,14 +691,13 @@ case "$1" in
|
|||||||
echo -e "${RED}User \"$TOUSER\" not found!${NC}"
|
echo -e "${RED}User \"$TOUSER\" not found!${NC}"
|
||||||
exit 3
|
exit 3
|
||||||
else
|
else
|
||||||
echo "Adjusting user in bashbot.rc ..."
|
echo "Adjusting user \"${TOUSER}\" files and permissions ..."
|
||||||
sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'$TOUSER'"/' bashbot.rc
|
sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'$TOUSER'"/' bashbot.rc
|
||||||
echo "Adjusting Owner and Permissions ..."
|
|
||||||
chown -R "$TOUSER" . ./*
|
chown -R "$TOUSER" . ./*
|
||||||
chmod 711 .
|
chmod 711 .
|
||||||
chmod -R a-w ./*
|
chmod -R a-w ./*
|
||||||
chmod -R u+w "${COUNT}" "${TMPDIR}" "${BOTADMIN}" ./*.log 2>/dev/null
|
chmod -R u+w "${COUNT}" "${TMPDIR}" "${BOTADMIN}" ./*.log 2>/dev/null
|
||||||
chmod -R o-r,o-w "${COUNT}" "${TMPDIR}" "${TOKEN}" "${BOTADMIN}" "${BOTACL}" 2>/dev/null
|
chmod -R o-r,o-w "${COUNT}" "${TMPDIR}" "${TOKENFILE}" "${BOTADMIN}" "${BOTACL}" 2>/dev/null
|
||||||
ls -la
|
ls -la
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.61-0-g3b17bc2
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
@ -28,8 +28,10 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# run shellcheck before commit
|
# run shellcheck before commit
|
||||||
echo "read files from dev/shellcheck.files ..."
|
set +f
|
||||||
FILES=$(sed '/^#/d' <"dev/shellcheck.files")
|
FILES="$(find ./* -name '*.sh')"
|
||||||
|
set -f
|
||||||
|
FILES="${FILES} $(sed '/^#/d' <"dev/shellcheck.files")"
|
||||||
if [ "$FILES" != "" ]; then
|
if [ "$FILES" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
shellcheck -x ${FILES} || exit 1
|
shellcheck -x ${FILES} || exit 1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# this has to run once atfer git clone
|
# this has to run once atfer git clone
|
||||||
# and every time we create new hooks
|
# and every time we create new hooks
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
@ -1,15 +1,3 @@
|
|||||||
# list of files to run shellscheck against
|
# list of additional files to check from shellcheck
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
# main files
|
|
||||||
bashbot.sh
|
|
||||||
commands.sh
|
|
||||||
bashbot.rc
|
bashbot.rc
|
||||||
# example files
|
|
||||||
examples/calc.sh
|
|
||||||
examples/notify.sh
|
|
||||||
examples/question.sh
|
|
||||||
# dev files
|
|
||||||
dev/version.sh
|
|
||||||
dev/install-hooks.sh
|
|
||||||
dev/hooks/pre-commit.sh
|
|
||||||
dev/hooks/pre-push.sh
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
#
|
#
|
||||||
# Easy Versioning in git:
|
# Easy Versioning in git:
|
||||||
@ -45,7 +45,7 @@ unset IFS
|
|||||||
VERSION="$(git describe --tags --long)"
|
VERSION="$(git describe --tags --long)"
|
||||||
echo "Update to version $VERSION ..."
|
echo "Update to version $VERSION ..."
|
||||||
|
|
||||||
FILES="* doc/* dev/* dev/*/*"
|
FILES="$(find ./*)"
|
||||||
[ "$1" != "" ] && FILES="$*"
|
[ "$1" != "" ] && FILES="$*"
|
||||||
|
|
||||||
for file in $FILES
|
for file in $FILES
|
||||||
|
@ -61,5 +61,5 @@ group. This step is up to you actually.
|
|||||||
|
|
||||||
#### [Next Getting started](2_usage.md)
|
#### [Next Getting started](2_usage.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action"
|
|||||||
#### [Prev Create Bot](1_firstbot.md)
|
#### [Prev Create Bot](1_firstbot.md)
|
||||||
#### [Next Advanced Usage](3_advanced.md)
|
#### [Next Advanced Usage](3_advanced.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -156,5 +156,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
|
|||||||
#### [Prev Advanced Usage](3_advanced.md)
|
#### [Prev Advanced Usage](3_advanced.md)
|
||||||
#### [Next Expert Use](4_expert.md)
|
#### [Next Expert Use](4_expert.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -104,5 +104,5 @@ An example crontab is provided in ```examples/bashbot.cron```.
|
|||||||
#### [Prev Expert Use](4_expert.md)
|
#### [Prev Expert Use](4_expert.md)
|
||||||
#### [Next Best Practice](5_practice.md)
|
#### [Next Best Practice](5_practice.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -112,5 +112,5 @@ The second warning is about an unused variable, this is true because in our exam
|
|||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
#### [Next Functions Reference](6_reference.md)
|
#### [Next Functions Reference](6_reference.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -348,5 +348,5 @@ Send Input from Telegram to waiting Interactive Chat.
|
|||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
#### [Next Developer Rules](7_develop.md)
|
#### [Next Developer Rules](7_develop.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -31,7 +31,37 @@ For a shell script running as a service it's important to be paranoid about quot
|
|||||||
In addition you can run ```dev/hooks/pre-commit.sh``` every time you want to shellcheck all files given in 'dev/shellcheck.files'.
|
In addition you can run ```dev/hooks/pre-commit.sh``` every time you want to shellcheck all files given in 'dev/shellcheck.files'.
|
||||||
|
|
||||||
|
|
||||||
|
## bashbot tests
|
||||||
|
Starting with version 0.70 bashbot has a test suite. To start testsuite run ```test/ALL-tests.sh```. ALL-tests.sh will only return 'SUCCESS' if all tests pass.
|
||||||
|
|
||||||
|
### creating new tests
|
||||||
|
To create a new test create a new bash script named ```p-name-test.sh```, where p is pass 'a-z' and name the name of your test.
|
||||||
|
All tests with the same pass are performed together.
|
||||||
|
|
||||||
|
Tests with no dependency to other tests will run in pass 'a', tests which need an initialized bahsbot environment must run in pass 'c' or later.
|
||||||
|
If '$1' is present the script is started from 'ALL-tests.sh' and the script runs in a temporary test environment in directory '$1'.
|
||||||
|
The temporary test environment is created when 'ALL-tests.sh' starts and deleted after all tests are finished.
|
||||||
|
|
||||||
|
Example test
|
||||||
|
```bash
|
||||||
|
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# file: z-bashbot-test.sh
|
||||||
|
|
||||||
|
# this test should always pass :-)
|
||||||
|
echo "Running test if bashbot.sh exists"
|
||||||
|
echo "................................."
|
||||||
|
|
||||||
|
if [ -f "bashbot.sh" ]; then
|
||||||
|
echo "bashbot.sh OK!"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "bashbot.sh missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
#### [Prev Function Reference](6_function.md)
|
#### [Prev Function Reference](6_function.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.61-2-gfd4dd8c
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
|
||||||
SHELL=/bin/sh
|
SHELL=/bin/sh
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
30
examples/question.sh
Executable file
30
examples/question.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This file is public domain in the USA and all free countries.
|
||||||
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
# adjust your language setting here
|
||||||
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
export 'LC_ALL=C.UTF-8'
|
||||||
|
export 'LANG=C.UTF-8'
|
||||||
|
export 'LANGUAGE=C.UTF-8'
|
||||||
|
|
||||||
|
unset IFS
|
||||||
|
# set -f # if you are paranoid use set -f to disable globbing
|
||||||
|
|
||||||
|
echo "Why hello there.
|
||||||
|
Would you like some tea (y/n)?"
|
||||||
|
read -r answer
|
||||||
|
[[ $answer =~ ^([yY][eE][sS]|[yY])$ ]] && echo "OK then, here you go: http://www.rivertea.com/blog/wp-content/uploads/2013/12/Green-Tea.jpg" || echo "OK then."
|
||||||
|
until [ "$SUCCESS" = "y" ] ;do
|
||||||
|
echo 'Do you like Music? mykeyboardstartshere "Yass!" , "No"'
|
||||||
|
read -r answer
|
||||||
|
case $answer in
|
||||||
|
'Yass!') echo "Goody! mykeyboardendshere";SUCCESS=y;;
|
||||||
|
'No') echo "Well that's weird. mykeyboardendshere";SUCCESS=y;;
|
||||||
|
*) SUCCESS=n;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
exit
|
49
test/ALL-tests.sh
Executable file
49
test/ALL-tests.sh
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# this has to run once atfer git clone
|
||||||
|
# and every time we create new hooks
|
||||||
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
# magic to ensure that we're always inside the root of our application,
|
||||||
|
# no matter from which directory we'll run script
|
||||||
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
|
cd "${GIT_DIR}/.." || exit 1
|
||||||
|
|
||||||
|
# create test environment
|
||||||
|
TESTENV="/tmp/bashbot.test$$"
|
||||||
|
cp -r . "${TESTENV}"
|
||||||
|
|
||||||
|
#set -e
|
||||||
|
fail=0
|
||||||
|
tests=0
|
||||||
|
passed=0
|
||||||
|
#all_tests=${__dirname:}
|
||||||
|
#echo PLAN ${#all_tests}
|
||||||
|
for test in $(find test/*-test.sh | sort -u) ;
|
||||||
|
do
|
||||||
|
[ "${test}" = "test/all-tests.sh" ] && continue
|
||||||
|
[ ! -x "${test}" ] && continue
|
||||||
|
tests=$((tests+1))
|
||||||
|
echo "TEST: ${test}"
|
||||||
|
"${test}" "${TESTENV}"
|
||||||
|
ret=$?
|
||||||
|
if [ "$ret" -eq 0 ] ; then
|
||||||
|
echo "OK: ---- ${test}"
|
||||||
|
passed=$((passed+1))
|
||||||
|
else
|
||||||
|
echo "FAIL: $test $fail"
|
||||||
|
fail=$((fail+ret))
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$fail" -eq 0 ]; then
|
||||||
|
/bin/echo -n 'SUCCESS '
|
||||||
|
exitcode=0
|
||||||
|
else
|
||||||
|
/bin/echo -n 'FAILURE '
|
||||||
|
exitcode=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "${TESTENV}"
|
||||||
|
echo "${passed} / ${tests}"
|
||||||
|
exit ${exitcode}
|
10
test/a-commit-test.sh
Executable file
10
test/a-commit-test.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
# magic to ensure that we're always inside the root of our application,
|
||||||
|
# no matter from which directory we'll run script
|
||||||
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
|
cd "$GIT_DIR/.." || exit 1
|
||||||
|
|
||||||
|
dev/hooks/pre-commit.sh
|
||||||
|
|
9
test/a-push-test.sh
Executable file
9
test/a-push-test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
# magic to ensure that we're always inside the root of our application,
|
||||||
|
# no matter from which directory we'll run script
|
||||||
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
|
cd "$GIT_DIR/.." || exit 1
|
||||||
|
|
||||||
|
dev/hooks/pre-push.sh
|
28
test/b-init-test.sh
Executable file
28
test/b-init-test.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
||||||
|
|
||||||
|
# magic to ensure that we're always inside the root of our application,
|
||||||
|
# no matter from which directory we'll run script
|
||||||
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
|
cd "$GIT_DIR/.." || exit 1
|
||||||
|
|
||||||
|
TESTME="$(basename "$0")"
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# let's fake failing test for now
|
||||||
|
echo "Running bashbot init"
|
||||||
|
echo "............................"
|
||||||
|
# change to test env
|
||||||
|
[ "$1" = "" ] && echo "not called from testsuite, exit" && exit
|
||||||
|
cd "$1" || exit 1
|
||||||
|
|
||||||
|
|
||||||
|
unset IFS; set -f
|
||||||
|
|
||||||
|
# run bashbot first time with init
|
||||||
|
export TERM=""
|
||||||
|
"${1}/bashbot.sh" init >"${TESTME}.log" <<EOF
|
||||||
|
bashbottestscript
|
||||||
|
nobody
|
||||||
|
botadmin
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user