From 4a92879a5a01a1a34a1e60251f356c8260ac5cb9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 31 May 2013 13:47:15 +0200 Subject: [PATCH 01/13] Add support for phpunit tests. Integrated test-runner for phpunit which covers test-execution and code-coverage measurement. refs #4068, refs #4087 --- test/php/phpunit.xml | 22 ++++++++++++++++++++++ test/php/runtests.sh | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 test/php/phpunit.xml create mode 100755 test/php/runtests.sh diff --git a/test/php/phpunit.xml b/test/php/phpunit.xml new file mode 100644 index 000000000..d56bbb063 --- /dev/null +++ b/test/php/phpunit.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/test/php/runtests.sh b/test/php/runtests.sh new file mode 100755 index 000000000..7ea78fb11 --- /dev/null +++ b/test/php/runtests.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +phpunit "$@" . + +exit 0 From 7ac78fe29d7f2483bed511c7edcade3e70a3651c Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 31 May 2013 13:48:14 +0200 Subject: [PATCH 02/13] Add support for phpcs reports. Integrated style-checker for php source code. refs #4070 --- test/php/checkswag.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 test/php/checkswag.sh diff --git a/test/php/checkswag.sh b/test/php/checkswag.sh new file mode 100755 index 000000000..6f0ece381 --- /dev/null +++ b/test/php/checkswag.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=../../build/log/phpcs_results.xml --ignore=vendor "$@" ../.. + +exit 0 From 3544af245f6ac3650fb932e48968b8350ea87996 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 31 May 2013 13:51:07 +0200 Subject: [PATCH 03/13] Add support for javascript unittests. Integrated test-runner for Mocha which covers test-execution and code-coverage measurement. refs #4099, refs #4087 --- test/js/runtests.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 test/js/runtests.sh diff --git a/test/js/runtests.sh b/test/js/runtests.sh new file mode 100755 index 000000000..c5c4f4996 --- /dev/null +++ b/test/js/runtests.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +mocha --reporter "xunit" --recursive "$@" . > ../../build/log/mocha_results.xml +mocha --reporter "cobertura" --recursive "$@" . > ../../build/log/mocha_coverage.xml + +exit 0 From 5118432b82bd40c4d0a0fa670b396ef8ff1da667 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 31 May 2013 13:52:12 +0200 Subject: [PATCH 04/13] Add support for jshint reports. Integrated style-checker for javascript source code. refs #4098 --- test/js/.jshintignore | 1 + test/js/.jshintrc | 6 ++++++ test/js/checkswag.sh | 5 +++++ 3 files changed, 12 insertions(+) create mode 100644 test/js/.jshintignore create mode 100644 test/js/.jshintrc create mode 100755 test/js/checkswag.sh diff --git a/test/js/.jshintignore b/test/js/.jshintignore new file mode 100644 index 000000000..c9b36835d --- /dev/null +++ b/test/js/.jshintignore @@ -0,0 +1 @@ +../../library/vendor/** diff --git a/test/js/.jshintrc b/test/js/.jshintrc new file mode 100644 index 000000000..756e43b8a --- /dev/null +++ b/test/js/.jshintrc @@ -0,0 +1,6 @@ +/* See http://www.jshint.com/docs/#usage on how to use this file */ + +{ + + +} diff --git a/test/js/checkswag.sh b/test/js/checkswag.sh new file mode 100755 index 000000000..b2b0fe8a5 --- /dev/null +++ b/test/js/checkswag.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +jshint --reporter=jslint "$@" ../.. > ../../build/log/jshint_results.xml + +exit 0 From 5b58c07e287ca2771d39ed6a8bd7f65b81961447 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 31 May 2013 14:15:14 +0200 Subject: [PATCH 05/13] Establish directory structure for builds and tests. --- .gitignore | 2 ++ build/log/README | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 .gitignore create mode 100644 build/log/README diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..a7cd8c99e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build/log/* +!/build/log/README diff --git a/build/log/README b/build/log/README new file mode 100644 index 000000000..64e8e2a0f --- /dev/null +++ b/build/log/README @@ -0,0 +1,5 @@ +The purpose for this directory is to store temporary logs and +reports by test-runner, style-checkers or build-routines. + +"temporary" means in this case that the contents of this directory +are completely ignored by Git. From ee63f3fbd89a81c752b5065d9110b873522b4954 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 3 Jun 2013 10:36:27 +0200 Subject: [PATCH 06/13] Make Git ignore build/* and create it as needed. refs #4068 refs #4070 refs #4098 refs #4099 --- .gitignore | 3 +-- build/log/README | 5 ----- test/js/checkswag.sh | 3 +++ test/js/runtests.sh | 3 +++ test/php/checkswag.sh | 3 +++ test/php/runtests.sh | 3 +++ 6 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 build/log/README diff --git a/.gitignore b/.gitignore index a7cd8c99e..d9b4f015d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/build/log/* -!/build/log/README +/build/* diff --git a/build/log/README b/build/log/README deleted file mode 100644 index 64e8e2a0f..000000000 --- a/build/log/README +++ /dev/null @@ -1,5 +0,0 @@ -The purpose for this directory is to store temporary logs and -reports by test-runner, style-checkers or build-routines. - -"temporary" means in this case that the contents of this directory -are completely ignored by Git. diff --git a/test/js/checkswag.sh b/test/js/checkswag.sh index b2b0fe8a5..9f1f6df4e 100755 --- a/test/js/checkswag.sh +++ b/test/js/checkswag.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Make sure that the destination directory for logs and reports exists +mkdir -p ../../build/log + jshint --reporter=jslint "$@" ../.. > ../../build/log/jshint_results.xml exit 0 diff --git a/test/js/runtests.sh b/test/js/runtests.sh index c5c4f4996..71eb52a48 100755 --- a/test/js/runtests.sh +++ b/test/js/runtests.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Make sure that the destination directory for logs and reports exists +mkdir -p ../../build/log + mocha --reporter "xunit" --recursive "$@" . > ../../build/log/mocha_results.xml mocha --reporter "cobertura" --recursive "$@" . > ../../build/log/mocha_coverage.xml diff --git a/test/php/checkswag.sh b/test/php/checkswag.sh index 6f0ece381..f9e7c135c 100755 --- a/test/php/checkswag.sh +++ b/test/php/checkswag.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Make sure that the destination directory for logs and reports exists +mkdir -p ../../build/log + phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=../../build/log/phpcs_results.xml --ignore=vendor "$@" ../.. exit 0 diff --git a/test/php/runtests.sh b/test/php/runtests.sh index 7ea78fb11..aec3a0d49 100755 --- a/test/php/runtests.sh +++ b/test/php/runtests.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Make sure that the destination directory for logs and reports exists +mkdir -p ../../build/log + phpunit "$@" . exit 0 From 3a90825f9ec5f138ab65b82d0b1fed14b6996ba8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 3 Jun 2013 11:29:57 +0200 Subject: [PATCH 07/13] Add runner to generate html documentation. Implemented runner which translates each .txt file located in doc/ to html by using markdown. refs #4214 --- bin/createdoc.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 bin/createdoc.sh diff --git a/bin/createdoc.sh b/bin/createdoc.sh new file mode 100755 index 000000000..d64fa10a1 --- /dev/null +++ b/bin/createdoc.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +for filepath in `find ../doc -type f -name "*.txt"`; do + markdown $filepath > `dirname $filepath`/`basename $filepath .txt`.html +done + +exit 0 From 420f407df494f8b9119622d4edf0cb1cafc3babe Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 3 Jun 2013 11:40:42 +0200 Subject: [PATCH 08/13] Fix: Doc-runner uses wrong file extension. Updated Doc-runner so that it converts files with the md-extension instead of the txt-extension. refs #4214 --- bin/createdoc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/createdoc.sh b/bin/createdoc.sh index d64fa10a1..4e4dbc754 100755 --- a/bin/createdoc.sh +++ b/bin/createdoc.sh @@ -1,7 +1,7 @@ #!/bin/sh -for filepath in `find ../doc -type f -name "*.txt"`; do - markdown $filepath > `dirname $filepath`/`basename $filepath .txt`.html +for filepath in `find ../doc -type f -name "*.md"`; do + markdown $filepath > `dirname $filepath`/`basename $filepath .md`.html done exit 0 From 0592bff4efbe981fce9771441bfbcddcba7372ec Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Mon, 3 Jun 2013 15:13:42 +0200 Subject: [PATCH 09/13] Build server Add absolute directory for helper scripts refs #4067 refs #4213 refs #4099 refs #4098 refs #4214 --- bin/createdoc.sh | 7 ++++++- test/js/checkswag.sh | 11 ++++++++--- test/js/runtests.sh | 13 +++++++++---- test/php/checkswag.sh | 11 ++++++++--- test/php/runtests.sh | 7 ++++++- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/bin/createdoc.sh b/bin/createdoc.sh index 4e4dbc754..cb005fdd8 100755 --- a/bin/createdoc.sh +++ b/bin/createdoc.sh @@ -1,6 +1,11 @@ #!/bin/sh -for filepath in `find ../doc -type f -name "*.md"`; do +set -o nounset + +SCRIPTNAME=$(readlink -f $0) +DIR=$(dirname $SCRIPTNAME) + +for filepath in `find $DIR/../doc -type f -name "*.md"`; do markdown $filepath > `dirname $filepath`/`basename $filepath .md`.html done diff --git a/test/js/checkswag.sh b/test/js/checkswag.sh index 9f1f6df4e..bfd8f26e4 100755 --- a/test/js/checkswag.sh +++ b/test/js/checkswag.sh @@ -1,8 +1,13 @@ #!/bin/sh -# Make sure that the destination directory for logs and reports exists -mkdir -p ../../build/log +set -o nounset -jshint --reporter=jslint "$@" ../.. > ../../build/log/jshint_results.xml +SCRIPTNAME=$(readlink -f $0) +DIR=$(dirname $SCRIPTNAME) + +# Make sure that the destination directory for logs and reports exists +mkdir -p $DIR/build/log + +jshint --reporter=jslint "$@" ../.. > $DIR/build/log/jshint_results.xml exit 0 diff --git a/test/js/runtests.sh b/test/js/runtests.sh index 71eb52a48..41af329ac 100755 --- a/test/js/runtests.sh +++ b/test/js/runtests.sh @@ -1,9 +1,14 @@ #!/bin/sh -# Make sure that the destination directory for logs and reports exists -mkdir -p ../../build/log +set -o nounset -mocha --reporter "xunit" --recursive "$@" . > ../../build/log/mocha_results.xml -mocha --reporter "cobertura" --recursive "$@" . > ../../build/log/mocha_coverage.xml +SCRIPTNAME=$(readlink -f $0) +DIR=$(dirname $SCRIPTNAME) + +# Make sure that the destination directory for logs and reports exists +mkdir -p $DIR/build/log + +mocha --reporter "xunit" --recursive "$@" . > $DIR/build/log/mocha_results.xml +mocha --reporter "cobertura" --recursive "$@" . > $DIR/build/log/mocha_coverage.xml exit 0 diff --git a/test/php/checkswag.sh b/test/php/checkswag.sh index f9e7c135c..dafbc52b1 100755 --- a/test/php/checkswag.sh +++ b/test/php/checkswag.sh @@ -1,8 +1,13 @@ #!/bin/sh -# Make sure that the destination directory for logs and reports exists -mkdir -p ../../build/log +set -o nounset -phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=../../build/log/phpcs_results.xml --ignore=vendor "$@" ../.. +SCRIPTNAME=$(readlink -f $0) +DIR=$(dirname $SCRIPTNAME) + +# Make sure that the destination directory for logs and reports exists +mkdir -p $DIR/../../build/log + +phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=$DIR/build/log/phpcs_results.xml --ignore=vendor "$@" ../.. exit 0 diff --git a/test/php/runtests.sh b/test/php/runtests.sh index aec3a0d49..a8b6901f4 100755 --- a/test/php/runtests.sh +++ b/test/php/runtests.sh @@ -1,7 +1,12 @@ #!/bin/sh +set -o nounset + +SCRIPTNAME=$(readlink -f $0) +DIR=$(dirname $SCRIPTNAME) + # Make sure that the destination directory for logs and reports exists -mkdir -p ../../build/log +mkdir -p $DIR/../../build/log phpunit "$@" . From 71f2c408df83da070d5c33feca16d8bfb070664e Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Mon, 3 Jun 2013 15:24:39 +0200 Subject: [PATCH 10/13] Integrate PHPCS Fix absolute directory issue. refs #4070 refs #4098 refs #4099 --- test/js/checkswag.sh | 4 ++-- test/js/runtests.sh | 6 +++--- test/php/checkswag.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/js/checkswag.sh b/test/js/checkswag.sh index bfd8f26e4..704ed94ec 100755 --- a/test/js/checkswag.sh +++ b/test/js/checkswag.sh @@ -6,8 +6,8 @@ SCRIPTNAME=$(readlink -f $0) DIR=$(dirname $SCRIPTNAME) # Make sure that the destination directory for logs and reports exists -mkdir -p $DIR/build/log +mkdir -p $DIR/../../build/log -jshint --reporter=jslint "$@" ../.. > $DIR/build/log/jshint_results.xml +jshint --reporter=jslint "$@" $DIR/../.. > $DIR/../../build/log/jshint_results.xm exit 0 diff --git a/test/js/runtests.sh b/test/js/runtests.sh index 41af329ac..d0196b0a2 100755 --- a/test/js/runtests.sh +++ b/test/js/runtests.sh @@ -6,9 +6,9 @@ SCRIPTNAME=$(readlink -f $0) DIR=$(dirname $SCRIPTNAME) # Make sure that the destination directory for logs and reports exists -mkdir -p $DIR/build/log +mkdir -p $DIR/../../build/log -mocha --reporter "xunit" --recursive "$@" . > $DIR/build/log/mocha_results.xml -mocha --reporter "cobertura" --recursive "$@" . > $DIR/build/log/mocha_coverage.xml +mocha --reporter "xunit" --recursive "$@" . > $DIR/../../build/log/mocha_results.xml +mocha --reporter "cobertura" --recursive "$@" . > $DIR/../../build/log/mocha_coverage.xml exit 0 diff --git a/test/php/checkswag.sh b/test/php/checkswag.sh index dafbc52b1..f16f7e73f 100755 --- a/test/php/checkswag.sh +++ b/test/php/checkswag.sh @@ -8,6 +8,6 @@ DIR=$(dirname $SCRIPTNAME) # Make sure that the destination directory for logs and reports exists mkdir -p $DIR/../../build/log -phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=$DIR/build/log/phpcs_results.xml --ignore=vendor "$@" ../.. +phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=$DIR/build/log/phpcs_results.xml --ignore=vendor "$@" $DIR/../.. exit 0 From 4b225eccee4d4ce424f7735cb67312b75f4bd847 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 3 Jun 2013 16:07:52 +0200 Subject: [PATCH 11/13] Fix: Style-checkers report their output to wrong location --- test/js/checkswag.sh | 2 +- test/php/checkswag.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/js/checkswag.sh b/test/js/checkswag.sh index 704ed94ec..df73f5a5a 100755 --- a/test/js/checkswag.sh +++ b/test/js/checkswag.sh @@ -8,6 +8,6 @@ DIR=$(dirname $SCRIPTNAME) # Make sure that the destination directory for logs and reports exists mkdir -p $DIR/../../build/log -jshint --reporter=jslint "$@" $DIR/../.. > $DIR/../../build/log/jshint_results.xm +jshint --reporter=jslint "$@" $DIR/../.. > $DIR/../../build/log/jshint_results.xml exit 0 diff --git a/test/php/checkswag.sh b/test/php/checkswag.sh index f16f7e73f..2d3bfa856 100755 --- a/test/php/checkswag.sh +++ b/test/php/checkswag.sh @@ -8,6 +8,6 @@ DIR=$(dirname $SCRIPTNAME) # Make sure that the destination directory for logs and reports exists mkdir -p $DIR/../../build/log -phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=$DIR/build/log/phpcs_results.xml --ignore=vendor "$@" $DIR/../.. +phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=$DIR/../../build/log/phpcs_results.xml --ignore=vendor "$@" $DIR/../.. exit 0 From ed24a90c1a66a5bb0b2a5e45fdaac08b840ceede Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Tue, 4 Jun 2013 11:16:09 +0200 Subject: [PATCH 12/13] Integrate PHPUNIT Modify tester, chdir to tests directory and test binary refs #4068 --- test/php/runtests.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/php/runtests.sh b/test/php/runtests.sh index a8b6901f4..0caa34742 100755 --- a/test/php/runtests.sh +++ b/test/php/runtests.sh @@ -4,10 +4,18 @@ set -o nounset SCRIPTNAME=$(readlink -f $0) DIR=$(dirname $SCRIPTNAME) +PHPUNIT=$(which phpunit) + +if [[ ! -x $PHPUNIT ]]; then + echo "PHPUnit not found!" + exit 1 +fi # Make sure that the destination directory for logs and reports exists mkdir -p $DIR/../../build/log -phpunit "$@" . +cd $DIR + +$PHPUNIT "$@" . exit 0 From 321aa9b4e3871782915330f2b9d4f559ee272666 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Tue, 4 Jun 2013 11:25:08 +0200 Subject: [PATCH 13/13] Integrate PHPCS Include only own code, test for binary refs #4070 --- test/php/checkswag.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/php/checkswag.sh b/test/php/checkswag.sh index 2d3bfa856..8d4850379 100755 --- a/test/php/checkswag.sh +++ b/test/php/checkswag.sh @@ -4,10 +4,21 @@ set -o nounset SCRIPTNAME=$(readlink -f $0) DIR=$(dirname $SCRIPTNAME) +PHPCS=$(which phpcs) + +if [[ ! -x $PHPCS ]]; then + echo "PHPCS not found!" + exit 1 +fi # Make sure that the destination directory for logs and reports exists mkdir -p $DIR/../../build/log -phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 --report-checkstyle=$DIR/../../build/log/phpcs_results.xml --ignore=vendor "$@" $DIR/../.. +phpcs -p --standard=PSR2 --extensions=php --encoding=utf-8 \ + --report-checkstyle=$DIR/../../build/log/phpcs_results.xml \ + "$@" \ + $DIR/../../application \ + $DIR/../../library/Icinga \ + $DIR/../../bin exit 0