diff --git a/.travis.yml b/.travis.yml index 2b7a34d7..e3028fad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ env: matrix: - LUA=5.2 LUANAME=lua5.2 BUILD_APIDOC=true DO_COVERAGE=true # Note: luarocks does not work with Lua 5.0. - - LUA=5.1 LUANAME=lua5.1 + - LUA=5.1 LUANAME=lua5.1 BUILD_IN_DIR=/tmp/awesome-build # luajit: installed from source. - LUA=5.1 LUANAME=luajit-2.0 LUALIBRARY=/usr/lib/libluajit-5.1.so LUAROCKS_ARGS=--lua-suffix=jit-2.0.4 # Lua 5.2 with older lgi and screen size not divisible by 2. @@ -92,6 +92,13 @@ install: script: - export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIBRARY} -DLUA_INCLUDE_DIR=${LUAINCLUDE} -D OVERRIDE_VERSION=$AWESOME_VERSION" + - | + if [ -n "$BUILD_IN_DIR" ]; then + SOURCE_DIRECTORY="$PWD" + mkdir "$BUILD_IN_DIR" + cd "$BUILD_IN_DIR" + cmake $CMAKE_ARGS "$SOURCE_DIRECTORY" + fi - make && sudo env PATH=$PATH make install && awesome --version && make check - | if [ "$DO_COVERAGE" = "true" ]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index 14a06e02..cf8045e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,7 +361,7 @@ endif() # {{{ Tests set(CHECK_TARGETS check-integration) add_custom_target(check-integration - "${CMAKE_SOURCE_DIR}/tests/run.sh" + sh -c "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ${CMAKE_SOURCE_DIR}/tests/run.sh" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMENT "Running integration tests" VERBATIM) diff --git a/tests/run.sh b/tests/run.sh index 3780ca14..bb52bdf2 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -17,6 +17,12 @@ if [ "$CI" = true ]; then set -x fi +source_dir="$PWD" +build_dir="$CMAKE_BINARY_DIR" +if [ -z "$build_dir" ]; then + build_dir="$PWD/build" +fi + # Change to file's dir (POSIXly). cd -P -- "$(dirname -- "$0")" this_dir=$PWD @@ -28,8 +34,6 @@ else tests=$this_dir/test*.lua fi -root_dir=$PWD/.. - # Travis. if [ "$CI" = true ]; then HEADLESS=1 @@ -44,13 +48,13 @@ export TEST_PAUSE_ON_ERRORS # Used in tests/_runner.lua. XEPHYR=Xephyr XVFB=Xvfb -AWESOME=$root_dir/build/awesome +AWESOME=$build_dir/awesome if ! [ -x "$AWESOME" ]; then echo "$AWESOME is not executable." >&2 exit 1 fi -RC_FILE=$root_dir/build/awesomerc.lua -AWESOME_CLIENT="$root_dir/utils/awesome-client" +RC_FILE=$build_dir/awesomerc.lua +AWESOME_CLIENT="$source_dir/utils/awesome-client" D=:5 SIZE="${TESTS_SCREEN_SIZE:-1024x768}" @@ -71,7 +75,7 @@ else # ( sleep 1; kill -USR1 $xserver_pid ) & fi -cd $root_dir/build +cd $build_dir LUA_PATH="$(lua -e 'print(package.path)');lib/?.lua;lib/?/init.lua" # Add test dir (for _runner.lua). @@ -160,21 +164,21 @@ eval $(DISPLAY="$D" dbus-launch --sh-syntax --exit-with-session) if [ "$CI" != true ]; then # Prepare a config file pointing to a working theme # Handle old filename of config files (useful for git-bisect). - if [ -f $root_dir/awesomerc.lua.in ]; then + if [ -f $source_dir/awesomerc.lua.in ]; then SED_IN=.in fi RC_FILE=$tmp_files/awesomerc.lua THEME_FILE=$tmp_files/theme.lua - sed -e "s:.*beautiful.init(.*default/theme.lua.*:beautiful.init('$THEME_FILE'):" $root_dir/awesomerc.lua$SED_IN > $RC_FILE - sed -e "s:@AWESOME_THEMES_PATH@/default/titlebar:$root_dir/build/themes/default/titlebar:" \ - -e "s:@AWESOME_THEMES_PATH@:$root_dir/themes/:" \ - -e "s:@AWESOME_ICON_PATH@:$root_dir/icons:" $root_dir/themes/default/theme.lua$SED_IN > $THEME_FILE + sed -e "s:.*beautiful.init(.*default/theme.lua.*:beautiful.init('$THEME_FILE'):" $source_dir/awesomerc.lua$SED_IN > $RC_FILE + sed -e "s:@AWESOME_THEMES_PATH@/default/titlebar:$build_dir/themes/default/titlebar:" \ + -e "s:@AWESOME_THEMES_PATH@:$source_dir/themes/:" \ + -e "s:@AWESOME_ICON_PATH@:$source_dir/icons:" $source_dir/themes/default/theme.lua$SED_IN > $THEME_FILE fi # Start awesome. start_awesome() { export DISPLAY="$D" - cd $root_dir/build + cd $build_dir DISPLAY="$D" "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS > $awesome_log 2>&1 & awesome_pid=$! cd - >/dev/null