From 20232f61ef38b0a300a2d0b64de43becb83384be Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 3 Feb 2016 22:30:00 -0800 Subject: [PATCH 1/3] build: more travis build fix --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14741b31c..a99782ff2 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,8 +62,6 @@ 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: From 9fff21cbe7876dfb14c5e52e969635ee18c2a4ea Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 3 Feb 2016 23:37:00 -0800 Subject: [PATCH 2/3] kodev: add test command --- kodev | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) 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 From 98d5026b8e626812ca9f3a8dc8ea44bae3ca65fd Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Thu, 4 Feb 2016 00:07:04 -0800 Subject: [PATCH 3/3] build: retry testfront to get around occasional segfault in travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a99782ff2..9a0838e74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ install: script: - travis_retry make fetchthirdparty - make all - - make testfront + - travis_retry make testfront after_success: - make coverage