diff --git a/.travis.yml b/.travis.yml index 14741b31c..9a0838e74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,15 +45,15 @@ install: - git clone https://github.com/torch/luajit-rocks.git - pushd luajit-rocks - git checkout 6529891 - - cmake . -DWITH_LUA52=ON -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/install + - cmake . -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/install - make install - popd - export PATH=$PATH:${TRAVIS_BUILD_DIR}/install/bin - mkdir $HOME/.luarocks - cp ${TRAVIS_BUILD_DIR}/install/etc/luarocks/config.lua $HOME/.luarocks/config.lua - echo "wrap_bin_scripts = false" >> $HOME/.luarocks/config.lua - - travis_retry luarocks --local install ansicolors - travis_retry luarocks --local install luafilesystem + - travis_retry luarocks --local install ansicolors - travis_retry luarocks --local install busted 2.0.rc11-0 #- travis_retry luarocks --local install busted 1.11.1-1 #- mv -f $HOME/.luarocks/bin/busted_bootstrap $HOME/.luarocks/bin/busted @@ -62,14 +62,12 @@ install: - travis_retry luarocks --local install luasec OPENSSL_LIBDIR=/usr/lib/x86_64-linux-gnu - travis_retry luarocks --local install luacov-coveralls --server=http://rocks.moonscript.org/dev # add local rocks to $PATH - # on newer luarocks, `luarocks path --bin` would suffice because it includes the PATH now - - luarocks path --bin - eval $(luarocks path --bin) script: - travis_retry make fetchthirdparty - make all - - make testfront + - travis_retry make testfront after_success: - make coverage diff --git a/kodev b/kodev index c437bd23c..5ac86e20b 100755 --- a/kodev +++ b/kodev @@ -2,6 +2,15 @@ CURDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +function assert_return_zero { + if [ $1 -ne 0 ]; then + if [ ! -z $2 ]; then + echo $2 + fi + exit 1 + fi +} + function setup_env { files=("./koreader-emulator-*/koreader") export EMU_DIR=${files[0]} @@ -36,33 +45,43 @@ ${SUPPORTED_TARGETS}" ;; kindle) make TARGET=kindle + assert_return_zero $? ;; kobo) make TARGET=kobo + assert_return_zero $? ;; kindle-legacy) make TARGET=kindle-legacy + assert_return_zero $? ;; android) if [ ! -d ${CURDIR}/base/toolchain/android-toolchain ]; then make android-toolchain + assert_return_zero $? fi make TARGET=android + assert_return_zero $? ;; pocketbook) if [ ! -d ${CURDIR}/base/toolchain/pocketbook-toolchain ]; then make pocketbook-toolchain + assert_return_zero $? fi make TARGET=pocketbook + assert_return_zero $? ;; ubuntu-touch) make TARGET=ubuntu-touch + assert_return_zero $? ;; win32) make TARGET=win32 + assert_return_zero $? ;; *) make + assert_return_zero $? "Failed to build emulator!" setup_env ;; esac @@ -225,6 +244,34 @@ OPTIONS: popd } +function kodev-test { + TEST_HELP_MSG=" +usage: test [front|base] + + TEST_NAME is optional. If no TEST_NAME is given, all tests will be run. + " + + if [ $# -lt 1 ]; then + echo "${TEST_HELP_MSG}" + exit 1 + fi + + setup_env + make ${EMU_DIR}/.busted + pushd ${EMU_DIR} + + test_path=./spec/$1/unit + + if [ ! -z $2 ]; then + test_path="${test_path}/$2" + fi + busted --exclude-tags=notest ${test_path} + + popd +} + + + HELP_MSG=" usage: $0 COMMAND @@ -265,6 +312,10 @@ case $1 in shift 1 kodev-run $@ ;; + test) + shift 1 + kodev-test $@ + ;; --help | -h) echo "${HELP_MSG}" exit 0