From cc867e0a0790ff045802b9e6fc793220fc185da3 Mon Sep 17 00:00:00 2001 From: cytopia Date: Tue, 12 Jun 2018 14:37:34 +0200 Subject: [PATCH] Restructure tests --- .travis.yml | 338 +------------------------------------------- Makefile | 21 +++ README.md | 70 +++++++-- test/README.md | 3 + test/test.sh | 40 ++++++ test/test_single.sh | 141 ++++++++++++++++++ 6 files changed, 261 insertions(+), 352 deletions(-) create mode 100644 test/README.md create mode 100755 test/test.sh create mode 100755 test/test_single.sh diff --git a/.travis.yml b/.travis.yml index de85e1d..cb6086a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,340 +76,4 @@ script: #------------------------------------------------------------ # 2.) Output Info #------------------------------------------------------------ - - bin/file-cr --info - - bin/file-crlf --info - - bin/file-empty --info - - bin/file-nullbyte-char --info - - bin/file-trailing-newline --info - - bin/file-trailing-single-newline --info - - bin/file-trailing-space --info - - bin/file-utf8 --info - - bin/file-utf8-bom --info - - bin/git-conflicts --info - - bin/git-ignored --info - - bin/inline-css --info - - bin/inline-js --info - - bin/regex-grep --info - - bin/regex-perl --info - - bin/syntax-bash --info - - bin/syntax-css --info - - bin/syntax-js --info - - bin/syntax-json --info - #- bin/syntax-markdown --info - - bin/syntax-perl --info - - bin/syntax-php --info - - bin/syntax-python --info - - bin/syntax-ruby --info - - bin/syntax-scss --info - - bin/syntax-sh --info - - - #------------------------------------------------------------ - # 3.) Test the scripts in dry mode - #------------------------------------------------------------ - - bin/file-cr --path=. --config=etc/awesome-ci.conf --dry - - bin/file-crlf --path=. --config=etc/awesome-ci.conf --dry - - bin/file-empty --path=. --config=etc/awesome-ci.conf --dry - - bin/file-nullbyte-char --path=. --config=etc/awesome-ci.conf --dry - - bin/file-trailing-newline --path=. --config=etc/awesome-ci.conf --dry - - bin/file-trailing-single-newline --path=. --config=etc/awesome-ci.conf --dry - - bin/file-trailing-space --path=. --config=etc/awesome-ci.conf --dry - - bin/file-utf8 --path=. --config=etc/awesome-ci.conf --dry - - bin/file-utf8-bom --path=. --config=etc/awesome-ci.conf --dry - - bin/git-conflicts --path=. --config=etc/awesome-ci.conf --dry - - bin/git-ignored --path=. --dry - - bin/inline-css --path=. --config=etc/awesome-ci.conf --dry - - bin/inline-js --path=. --config=etc/awesome-ci.conf --dry - - bin/regex-grep --path=. --config=etc/awesome-ci.conf --dry - - bin/regex-perl --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-bash --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-css --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-js --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-json --path=. --config=etc/awesome-ci.conf --dry - #- bin/syntax-markdown --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-perl --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-php --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-python --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-ruby --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-scss --path=. --config=etc/awesome-ci.conf --dry - - bin/syntax-sh --path=. --config=etc/awesome-ci.conf --dry - - - #------------------------------------------------------------ - # 4.) Test the scripts in real mode (without findings) - #------------------------------------------------------------ - - bin/file-cr --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-cr --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-cr --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-crlf --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-crlf --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-crlf --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-empty --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-empty --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-empty --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-nullbyte-char --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-nullbyte-char --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-nullbyte-char --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-trailing-newline --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-trailing-newline --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-trailing-newline --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-trailing-single-newline --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-trailing-single-newline --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-trailing-single-newline --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-trailing-space --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-trailing-space --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-trailing-space --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-utf8 --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-utf8 --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-utf8 --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/file-utf8-bom --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/file-utf8-bom --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/file-utf8-bom --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/git-conflicts --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/git-conflicts --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/git-conflicts --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/git-ignored --path=test/ok/ - - - bin/inline-css --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/inline-css --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/inline-css --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/inline-js --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/inline-js --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/inline-js --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - #- bin/regex-grep --path=test/ok/ --config=etc/awesome-ci.conf - #- bin/regex-perl --path=test/ok/ --config=etc/awesome-ci.conf - # - - bin/syntax-bash --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-bash --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-bash --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-css --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-css --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-css --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-js --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-js --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-js --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-json --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-json --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-json --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - #- bin/syntax-markdown --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - #- bin/syntax-markdown --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - #- bin/syntax-markdown --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-perl --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-perl --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-perl --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-php --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-php --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-php --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-python --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-python --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-python --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-ruby --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-ruby --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-ruby --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-scss --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-scss --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-scss --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - bin/syntax-sh --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --list - - bin/syntax-sh --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" --verbose - - bin/syntax-sh --path=test/ok/ --config=etc/awesome-ci.conf --ignore=".git/,*.pyc,test/,configure.in" - - - #------------------------------------------------------------ - # 5.) Find errors - #------------------------------------------------------------ - - if bin/file-cr --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-cr --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-crlf --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-crlf --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-empty --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-empty --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-nullbyte-char --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-nullbyte-char --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-trailing-newline --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-trailing-newline --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-trailing-single-newline --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-trailing-single-newline --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-trailing-space --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-trailing-space --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-utf8 --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-utf8 --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/file-utf8-bom --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/file-utf8-bom --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/git-conflicts --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/git-conflicts --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - #- if bin/git-ignored --path=test/err - - - if bin/inline-css --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/inline-css --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/inline-js --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/inline-js --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - #- if bin/regex-grep --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - #- if bin/regex-perl --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-bash --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-bash --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-css --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-css --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-js --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-js --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-json --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-json --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - #- if bin/syntax-markdown --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - #- if bin/syntax-markdown --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-perl --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-perl --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-php --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-php --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-python --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-python --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-ruby --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-ruby --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-scss --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-scss --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - if bin/syntax-sh --path=test/err --config=etc/awesome-ci.conf --verbose; then false; else true; fi - - if bin/syntax-sh --path=test/err --config=etc/awesome-ci.conf; then false; else true; fi - - - #------------------------------------------------------------ - # 6.) Find Success - #------------------------------------------------------------ - - bin/file-cr --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-cr --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-cr --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-crlf --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-crlf --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-crlf --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-empty --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-empty --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-empty --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-nullbyte-char --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-nullbyte-char --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-nullbyte-char --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-trailing-newline --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-trailing-newline --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-trailing-newline --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-trailing-single-newline --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-trailing-single-newline --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-trailing-single-newline --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-trailing-space --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-trailing-space --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-trailing-space --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-utf8 --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-utf8 --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-utf8 --path=test/ok --config=etc/awesome-ci.conf - - - bin/file-utf8-bom --path=test/ok --config=etc/awesome-ci.conf --list - - bin/file-utf8-bom --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/file-utf8-bom --path=test/ok --config=etc/awesome-ci.conf - - - bin/git-conflicts --path=test/ok --config=etc/awesome-ci.conf --list - - bin/git-conflicts --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/git-conflicts --path=test/ok --config=etc/awesome-ci.conf - - #- bin/git-ignored --path=test/ok - - - bin/inline-css --path=test/ok --config=etc/awesome-ci.conf --list - - bin/inline-css --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/inline-css --path=test/ok --config=etc/awesome-ci.conf - - - bin/inline-js --path=test/ok --config=etc/awesome-ci.conf --list - - bin/inline-js --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/inline-js --path=test/ok --config=etc/awesome-ci.conf - - #- bin/regex-grep --path=test/ok --config=etc/awesome-ci.conf - #- bin/regex-perl --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-bash --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-bash --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-bash --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-css --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-css --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-css --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-js --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-js --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-js --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-json --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-json --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-json --path=test/ok --config=etc/awesome-ci.conf - - #- bin/syntax-markdown --path=test/ok --config=etc/awesome-ci.conf --list - #- bin/syntax-markdown --path=test/ok --config=etc/awesome-ci.conf --verbose - #- bin/syntax-markdown --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-perl --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-perl --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-perl --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-php --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-php --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-php --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-python --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-python --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-python --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-ruby --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-ruby --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-ruby --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-scss --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-scss --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-scss --path=test/ok --config=etc/awesome-ci.conf - - - bin/syntax-sh --path=test/ok --config=etc/awesome-ci.conf --list - - bin/syntax-sh --path=test/ok --config=etc/awesome-ci.conf --verbose - - bin/syntax-sh --path=test/ok --config=etc/awesome-ci.conf + - make test diff --git a/Makefile b/Makefile index 531dfd6..925c66b 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,23 @@ SHELL = /bin/sh MKDIR_P = mkdir -p +# If ./configure has been run, include configure.in +ifneq ("$(wildcard configure.in)","") +include configure.in +endif + +# 'test' directory exists, therefore force make to run test +.PHONY: test + ### ### Help ### help: @echo Options + @echo " make test" + @echo " Test awesome-ci scripts" + @echo "" @echo " make install" @echo " Install everthing (requires sudo or root)" @echo "" @@ -61,3 +72,13 @@ clean: ### docker: docker build -t cytopia/awesome-ci . + + +### +### +### +test: + ./test/test.sh + + + diff --git a/README.md b/README.md index a0a5916..bced673 100644 --- a/README.md +++ b/README.md @@ -4,24 +4,19 @@ [![Latest Stable Version](https://poser.pugx.org/cytopia/awesome-ci/v/stable)](https://packagist.org/packages/cytopia/awesome-ci) [![Total Downloads](https://poser.pugx.org/cytopia/awesome-ci/downloads)](https://packagist.org/packages/cytopia/awesome-ci) [![License](https://poser.pugx.org/cytopia/awesome-ci/license)](http://opensource.org/licenses/MIT) -[![Type](https://img.shields.io/badge/type-bash-red.svg)](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29) ---- - -**Runs on** +**Runs on every good OS** [![Linux](https://raw.githubusercontent.com/cytopia/icons/master/64x64/linux.png)](https://www.kernel.org/) [![FreeBSD](https://raw.githubusercontent.com/cytopia/icons/master/64x64/freebsd.png)](https://www.freebsd.org) [![OSX](https://raw.githubusercontent.com/cytopia/icons/master/64x64/osx.png)](https://www.apple.com/osx) +Continuous Integration command line tools for git repositories, file characteristics, syntax errors +and static source code analysis. -Lot's of tools for git, file and static source code analysis. - -**Documentation** +Awesome-CI is capable of finding various problems in your code repository as well as fixing them +automatically. -* [Dependencies](dependencies/) -* [Examples](EXAMPLES.md) -* [Regex Contributions](REGEX_CONTRIBUTIONS.md) --- @@ -33,10 +28,12 @@ Lot's of tools for git, file and static source code analysis. 4. [Custom regex contributions](#custom-regex-contributions) 5. [General usage](#general-usage) 6. [Installation](i#installation) - 1. [Install OSX](#install-osx) - 2. [Install Linux/BSD](#install-linuxbsd) + 1. [Requirements](#requirements) + 2. [Install OSX](#install-osx) + 3. [Install Linux/BSD](#install-linuxbsd) 7. [Awesome CI Docker image](#awesome-ci-docker-image) -8. [License](#license) +8. [Documentation](#documentation) +9. [License](#license) ## Tools @@ -149,6 +146,23 @@ Please use pull requests to add useful checks. ## Installation +### Requirements + +Awesome-ci requires the following tools to be installed: + +* `dos2unix` +* `eslint` +* `file` +* `git` +* `jsonlint` +* `mdl` +* `perl` +* `php` +* `python` +* `ruby` +* `scss_lint` +* `shellcheck` + ### Install OSX ```bash @@ -174,13 +188,39 @@ make install ## Awesome CI Docker image -Instead of installing it, you can also use the bundled Docker image: -**[cytopia/awesome-ci](https://hub.docker.com/r/cytopia/awesome-ci/)** +Instead of installing awesome-ci and all its required dependencies locally on your computer, +you can also use the bundled Docker image +**[cytopia/awesome-ci](https://hub.docker.com/r/cytopia/awesome-ci/)** which has everything +pre-installed and is built nightly by travis-ci. ```bash docker run -v ${PWD}:/ac cytopia/awesome-ci file-crlf --path=/ac ``` +The above example is using `file-crlf` to scan the current directory for files containing +Windows newlines: + +* `${PWD}` (the current host directory) is mounted into the container's `/ac` directoy +* `file-crlf` path then points (inside the container) to `/ac` (which is the current host directory) +* `/ac` can actually be named by whatever name you want + +If you use an awesome-ci configuration which is not inside the directory you want to check, you +will also have to mount that into the container: +```bash +docker run \ + -v /host/path/to/awesome-ci.conf:/etc/awesome-ci.conf \ + -v ${PWD}:/ac cytopia/awesome-ci file-crlf --path=/ac --config=/etc/awesome-ci.conf +``` + +## Documentation + +To find out more about awesome-ci, have a look at the following links. + +* [Dependencies](dependencies/) +* [Examples](EXAMPLES.md) +* [Regex Contributions](REGEX_CONTRIBUTIONS.md) + + ## License [MIT License](LICENSE.md) diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..a3b0bb3 --- /dev/null +++ b/test/README.md @@ -0,0 +1,3 @@ +# Awesome-CI test cases + +This directory contains test cases for awesome-ci. diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..1c6784f --- /dev/null +++ b/test/test.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + + +### +### Define Paths +### +GIT_PATH="$( cd "$(dirname "$0")" ; pwd -P )/.." +RUN_PATH="${GIT_PATH}/test/test_single.sh" + + +${RUN_PATH} file-cr +${RUN_PATH} file-crlf +${RUN_PATH} file-empty +${RUN_PATH} file-nullbyte-char +${RUN_PATH} file-trailing-newline +${RUN_PATH} file-trailing-single-newline +${RUN_PATH} file-trailing-space +${RUN_PATH} file-utf8 +${RUN_PATH} file-utf8-bom +${RUN_PATH} git-conflicts +${RUN_PATH} git-ignored +${RUN_PATH} inline-css +${RUN_PATH} inline-js +${RUN_PATH} regex-grep +${RUN_PATH} regex-perl +${RUN_PATH} syntax-bash +${RUN_PATH} syntax-css +${RUN_PATH} syntax-js +${RUN_PATH} syntax-json +${RUN_PATH} syntax-markdown +${RUN_PATH} syntax-perl +${RUN_PATH} syntax-php +${RUN_PATH} syntax-python +${RUN_PATH} syntax-ruby +${RUN_PATH} syntax-scss +${RUN_PATH} syntax-sh diff --git a/test/test_single.sh b/test/test_single.sh new file mode 100755 index 0000000..e36ff95 --- /dev/null +++ b/test/test_single.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + + +### +### Define Paths +### +GIT_PATH="$( cd "$(dirname "$0")" ; pwd -P )/.." +ETC_PATH="${GIT_PATH}/etc/awesome-ci.conf" +BIN_PATH="${GIT_PATH}/bin" + +TEST_SUCC_PATH="${GIT_PATH}/test/ok" +TEST_FAIL_PATH="${GIT_PATH}/test/err" + +# Add dependencies to path +PATH=${GIT_PATH}/dependencies:${PATH} + + +### +### Check arguments +### +if [ "${#}" -ne "1" ]; then + >&2 echo "This script requires exactly one argument: ${#} are given." + exit 1 +fi + +# Path to binary +BINARY="${BIN_PATH}/${1}" + + +############################################################ +# Functions +############################################################ + +run () { + local cmd="${1}" + + >&2 echo "----------------------------------------------------------------------------------------------------" + >&2 echo "\$ ${cmd}" + >&2 echo "----------------------------------------------------------------------------------------------------" + + ${cmd} +} + + +############################################################ +# Run tests +############################################################ + + +### +### 1. Info +### +COMMAND="${BINARY} --info" +if ! OUT="$( run "${COMMAND}" )"; then + echo "${OUT}" + >&2 echo "[Error] 'Info test' failed" + exit 1 +fi +echo "[TEST PASSED]" +echo + + +### +### 2. Dry +### +if [ "${1}" = "git-ignored" ]; then + COMMAND="${BINARY} --path=. --dry" +else + COMMAND="${BINARY} --path=. --config=${ETC_PATH} --dry" +fi +if ! OUT="$( run "${COMMAND}" )"; then + echo "${OUT}" + >&2 echo "[TEST FAILED] 'Dry test' failed" + exit 1 +fi +echo "[TEST PASSED]" +echo + + +### +### 3. Test OK +### +if [ "${1}" != "git-ignored" ] && [ "${1}" != "regex-grep" ] && [ "${1}" != "regex-perl" ]; then + + COMMAND="${BINARY} --path=${TEST_SUCC_PATH} --config=${ETC_PATH}" + + if ! OUT="$( run "${COMMAND} --list" )"; then + echo "${OUT}" + >&2 echo "[TEST FAILED] 'Success test' failed" + exit 1 + fi + echo "[TEST PASSED]" + echo + + if ! OUT="$( run "${COMMAND} --verbose" )"; then + echo "${OUT}" + >&2 echo "[TEST FAILED] 'Success test' failed" + exit 1 + fi + echo "[TEST PASSED]" + echo + + if ! OUT="$( run "${COMMAND}" )"; then + echo "${OUT}" + >&2 echo "[TEST FAILED] 'Success test' failed" + exit 1 + fi + echo "[TEST PASSED]" + echo +fi + + +### +### 3. Test Failure +### +if [ "${1}" != "git-ignored" ] && [ "${1}" != "regex-grep" ] && [ "${1}" != "regex-perl" ]; then + + COMMAND="${BINARY} --path=${TEST_FAIL_PATH} --config=${ETC_PATH}" + + if ! OUT="$( run "${COMMAND} --verbose" )"; then + echo "[TEST PASSED]" + echo + else + echo "${OUT}" + >&2 echo "[TEST FAILED] 'Failure test' failed" + exit 1 + fi + + if ! OUT="$( run "${COMMAND}" )"; then + echo "[TEST PASSED]" + echo + else + echo "${OUT}" + >&2 echo "[TEST FAILED] 'Failure test' failed" + exit 1 + fi +fi