diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 4 | ||||
-rwxr-xr-x | tests/all.sh | 5 | ||||
-rwxr-xr-x | tests/prepare.sh | 30 | ||||
-rwxr-xr-x | tests/t_codingstandard.sh | 24 |
5 files changed, 64 insertions, 0 deletions
@@ -3,3 +3,4 @@ __*__ !.gitignore +!.travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..48e2e49 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: python +python: "3.5" + +script: tests/all.sh diff --git a/tests/all.sh b/tests/all.sh new file mode 100755 index 0000000..d0fe307 --- /dev/null +++ b/tests/all.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd "$( dirname "${BASH_SOURCE[0]}" )" + +./t_codingstandard.sh +[[ $? -ne 0 ]] && exit 1 diff --git a/tests/prepare.sh b/tests/prepare.sh new file mode 100755 index 0000000..d8248b4 --- /dev/null +++ b/tests/prepare.sh @@ -0,0 +1,30 @@ +#~/bin/bash +if [[ "$(basename -- "$0")" = "prepare.sh" ]]; then + echo "Please only source this script" + exit 1 +fi + +# Write basic configuration +cp ../example.conf mcwrapper.conf + +if [[ $PREPARED != "y" ]]; then + # Move to known directory + cd "$( dirname "${BASH_SOURCE[0]}" )" + + if [[ $MCSERVERS == "y" ]]; then + mkdir -p minecraft-server + echo "eula=true" > minecraft-server/eula.txt + # Get Minecraft 1.8.8 + [ -f minecraft-server/minecraft_server.1.8.8.jar ] || \ + wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8.8/minecraft_server.1.8.8.jar -O minecraft-server/minecraft_server.1.8.8.jar + # Get Minecraft 1.9 + [ -f minecraft-server/minecraft_server.1.9.jar ] || \ + wget https://s3.amazonaws.com/Minecraft.Download/versions/1.9/minecraft_server.1.9.jar -O minecraft-server/minecraft_server.1.9.jar + function mcservers_clean { + find minecraft-server | tail -n +2 | egrep -v "minecraft_server.*jar" | egrep -v "eula.txt" | xargs rm -rf + } + fi + + export PATH=$( realpath .. ):$PATH + export PREPARED="y" +fi diff --git a/tests/t_codingstandard.sh b/tests/t_codingstandard.sh new file mode 100755 index 0000000..4daba17 --- /dev/null +++ b/tests/t_codingstandard.sh @@ -0,0 +1,24 @@ +#!/bin/bash +cd "$( dirname "${BASH_SOURCE[0]}" )" +source prepare.sh + +echo "Checking code style using pep8" +pep8 ../mcwrapper +if [[ $? == 0 ]]; then + echo "Ok" +else + exit 1 +fi + +echo "Checking for common errors" +pyflakes ../mcwrapper +if [[ $? == 0 ]]; then + echo "Ok" +else + exit 1 +fi + +# This test is not part of standard check because of errors caused by dynamic variable +# loading to configuration. But it should be run from time to time to found other mistakes +#echo "Checking bugs and poor quality" +#pylint --msg-template="{line}: [{msg_id}({symbol}), {obj}] {msg}" --reports=n ../mcwrapper |