Merge pull request #3279 from sclu1034/feature/custom_build_lua_executable

Make CMake Lua executable customizable
This commit is contained in:
Emmanuel Lepage Vallée 2021-03-27 23:42:40 -07:00 committed by GitHub
commit 54e9cb4e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 234 additions and 107 deletions

View File

@ -412,14 +412,14 @@ if ("${TEST_MANUAL_SCREENS}" MATCHES "1")
endif() endif()
add_custom_target(check-integration add_custom_target(check-integration
${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ${TESTS_RUN_ENV} ./tests/run.sh \$\${TEST_RUN_ARGS:--W} ${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' LUA='${LUA_EXECUTABLE}' ${TESTS_RUN_ENV} ./tests/run.sh \$\${TEST_RUN_ARGS:--W}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running integration tests" COMMENT "Running integration tests"
DEPENDS ${PROJECT_AWE_NAME} DEPENDS ${PROJECT_AWE_NAME}
USES_TERMINAL) USES_TERMINAL)
add_dependencies(check-integration test-gravity) add_dependencies(check-integration test-gravity)
add_custom_target(check-themes add_custom_target(check-themes
${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ${TESTS_RUN_ENV} ./tests/themes/run.sh ${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' LUA='${LUA_EXECUTABLE}' ${TESTS_RUN_ENV} ./tests/themes/run.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Testing themes" COMMENT "Testing themes"
USES_TERMINAL USES_TERMINAL
@ -427,7 +427,7 @@ add_custom_target(check-themes
add_dependencies(check check-themes) add_dependencies(check check-themes)
add_custom_target(check-requires add_custom_target(check-requires
lua "${CMAKE_SOURCE_DIR}/build-utils/check_for_invalid_requires.lua" ${LUA_EXECUTABLE} "${CMAKE_SOURCE_DIR}/build-utils/check_for_invalid_requires.lua"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Checking use of require()" COMMENT "Checking use of require()"
USES_TERMINAL USES_TERMINAL

View File

@ -33,6 +33,7 @@ macro(a_find_program var prg req)
endif() endif()
endmacro() endmacro()
a_find_program(LUA_EXECUTABLE lua TRUE)
a_find_program(GIT_EXECUTABLE git FALSE) a_find_program(GIT_EXECUTABLE git FALSE)
# programs needed for man pages # programs needed for man pages
a_find_program(ASCIIDOCTOR_EXECUTABLE asciidoctor FALSE) a_find_program(ASCIIDOCTOR_EXECUTABLE asciidoctor FALSE)
@ -374,7 +375,7 @@ add_custom_command(TARGET setup_directories
add_custom_command( add_custom_command(
OUTPUT ${BUILD_DIR}/docs/06-appearance.md OUTPUT ${BUILD_DIR}/docs/06-appearance.md
COMMAND lua ${SOURCE_DIR}/docs/06-appearance.md.lua COMMAND ${LUA_EXECUTABLE} ${SOURCE_DIR}/docs/06-appearance.md.lua
${BUILD_DIR}/docs/06-appearance.md ${BUILD_DIR}/docs/06-appearance.md
DEPENDS DEPENDS
lgi-check-run lgi-check-run
@ -385,7 +386,7 @@ add_custom_command(
foreach(RULE_TYPE client tag screen notification) foreach(RULE_TYPE client tag screen notification)
add_custom_command( add_custom_command(
OUTPUT ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc OUTPUT ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
COMMAND lua ${SOURCE_DIR}/docs/build_rules_index.lua COMMAND ${LUA_EXECUTABLE} ${SOURCE_DIR}/docs/build_rules_index.lua
${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc ${BUILD_DIR}/docs/common/${RULE_TYPE}_rules_index.ldoc
${RULE_TYPE} ${RULE_TYPE}
@ -405,7 +406,7 @@ endforeach()
add_custom_command( add_custom_command(
OUTPUT ${BUILD_DIR}/awesomerc.lua ${BUILD_DIR}/docs/05-awesomerc.md OUTPUT ${BUILD_DIR}/awesomerc.lua ${BUILD_DIR}/docs/05-awesomerc.md
${BUILD_DIR}/script_files/rc.lua ${BUILD_DIR}/script_files/rc.lua
COMMAND lua ${SOURCE_DIR}/docs/05-awesomerc.md.lua COMMAND ${LUA_EXECUTABLE} ${SOURCE_DIR}/docs/05-awesomerc.md.lua
${BUILD_DIR}/docs/05-awesomerc.md ${SOURCE_DIR}/awesomerc.lua ${BUILD_DIR}/docs/05-awesomerc.md ${SOURCE_DIR}/awesomerc.lua
${BUILD_DIR}/awesomerc.lua ${BUILD_DIR}/awesomerc.lua
${BUILD_DIR}/script_files/rc.lua ${BUILD_DIR}/script_files/rc.lua
@ -414,7 +415,7 @@ add_custom_command(
add_custom_command( add_custom_command(
OUTPUT ${BUILD_DIR}/script_files/theme.lua OUTPUT ${BUILD_DIR}/script_files/theme.lua
COMMAND lua ${SOURCE_DIR}/docs/sample_theme.lua ${BUILD_DIR}/script_files/ COMMAND ${LUA_EXECUTABLE} ${SOURCE_DIR}/docs/sample_theme.lua ${BUILD_DIR}/script_files/
) )
# Create a target for the auto-generated awesomerc.lua and other files # Create a target for the auto-generated awesomerc.lua and other files

View File

@ -6,36 +6,39 @@ Awesome is a highly configurable, next generation framework window manager for X
## Building and installation ## Building and installation
After extracting the dist tarball, run: After extracting the dist tarball or cloning the repository, run:
```sh
make make
sudo make install
```
This will create a build directory, run `cmake` in it and build Awesome. This will
After building is finished, you can either install via `make install`: 1. create a build directory at `./build`,
2. run `cmake`,
3. build Awesome and
4. install it to the default prefix path `/usr/local`.
make install # you might need root permissions Alternatively to the above, you can generate a `.deb` or `.rpm` package, for easy installation management:
or by auto-generating a .deb or .rpm package, for easy removal later on:
```sh
make package make package
sudo dpkg -i awesome-x.y.z.deb sudo dpkg -i awesome-x.y.z.deb
# or # or
sudo rpm -Uvh awesome-x.y.z.rpm sudo rpm -Uvh awesome-x.y.z.rpm
```
NOTE: Awesome uses [`cmake`](https://cmake.org) to build. In case you want to ### Advanced options and testing
pass arguments to `cmake`, please use the `CMAKE_ARGS` environment variable. For
instance:
CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX=/opt/awesome" make
A full list of dependencies, more advanced build options, as well as instructions on how to use the test suite can be found [here](https://awesomewm.org/apidoc/10-building-and-testing.md.html).
### Installing current git master as a package receipts ### Installing current git master as a package receipts
#### Arch Linux AUR #### Arch Linux AUR
``` ```sh
sudo pacman -S --needed base-devel git sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/awesome-git.git git clone https://aur.archlinux.org/awesome-git.git
cd awesome-git cd awesome-git
@ -44,7 +47,7 @@ makepkg -fsri
#### Debian-based #### Debian-based
``` ```sh
sudo apt build-dep awesome sudo apt build-dep awesome
git clone https://github.com/awesomewm/awesome git clone https://github.com/awesomewm/awesome
cd awesome cd awesome
@ -52,76 +55,22 @@ make package
sudo apt install *.deb sudo apt install *.deb
``` ```
### Build dependencies
Awesome has the following dependencies (besides a more-or-less standard POSIX
environment):
- [CMake >= 3.0.0](https://cmake.org)
- [Lua >= 5.1.0](https://www.lua.org) or [LuaJIT](http://luajit.org)
- [LGI >= 0.8.0](https://github.com/pavouk/lgi)
- [xproto >= 7.0.15](https://www.x.org/archive//individual/proto/)
- [libxcb >= 1.6](https://xcb.freedesktop.org/) with support for the RandR, XTest, Xinerama, SHAPE and
XKB extensions
- [libxcb-cursor](https://xcb.freedesktop.org/)
- [libxcb-util >= 0.3.8](https://xcb.freedesktop.org/)
- [libxcb-keysyms >= 0.3.4](https://xcb.freedesktop.org/)
- [libxcb-icccm >= 0.3.8](https://xcb.freedesktop.org/)
- [libxcb-xfixes](https://xcb.freedesktop.org/)
- [xcb-util-xrm >= 1.0](https://github.com/Airblader/xcb-util-xrm)
- [libxkbcommon](http://xkbcommon.org/) with X11 support enabled
- [libstartup-notification >=
0.10](https://www.freedesktop.org/wiki/Software/startup-notification/)
- [cairo](https://www.cairographics.org/) with support for XCB and GObject
introspection
- [Pango](http://www.pango.org/) with support for Cairo and GObject
introspection
- [GLib >= 2.40](https://wiki.gnome.org/Projects/GLib) with support for GObject
introspection
- [GIO](https://developer.gnome.org/gio/stable/) with support for GObject
introspection
- [GdkPixbuf](https://wiki.gnome.org/Projects/GdkPixbuf)
- libX11 with xcb support
- [Imagemagick's convert utility](http://www.imagemagick.org/script/index.php)
- [libxdg-basedir >= 1.0.0](https://github.com/devnev/libxdg-basedir)
Additionally, the following optional dependencies exist:
- [DBus](https://www.freedesktop.org/wiki/Software/dbus/) for DBus integration
and the `awesome-client` utility
- [asciidoctor](https://asciidoctor.org/) for generating man pages
- [gzip](http://www.gzip.org/) for compressing man pages
- [ldoc >= 1.4.5](https://stevedonovan.github.io/ldoc/) for generating the
documentation
- [busted](https://olivinelabs.com/busted/) for running unit tests
- [luacheck](https://github.com/mpeterv/luacheck) for static code analysis
- [LuaCov](https://keplerproject.github.io/luacov/) for collecting code coverage
information
- libexecinfo on systems where libc does not provide `backtrace_symbols()` to
generate slightly better backtraces on crashes
- `Xephyr` or `Xvfb` for running integration tests
- [GTK+ >= 3.10](https://www.gtk.org/) for `./themes/gtk/`
- [xcb-errors](https://gitlab.freedesktop.org/xorg/lib/libxcb-errors) for
pretty-printing of X11 errors
- [libRSVG](https://wiki.gnome.org/action/show/Projects/LibRsvg) for displaying
SVG files without scaling artifacts
- [wmctrl](http://tripie.sweb.cz/utils/wmctrl) for testing WM interactions
with external actions
- [xterm](https://invisible-island.net/xterm/) for various test cases
## Running Awesome ## Running Awesome
You can directly select Awesome from your display manager. If not, you can You can directly select Awesome from your display manager. If not, you can
add the following line to your `.xinitrc` to start Awesome using `startx` add the following line to your `.xinitrc` to start Awesome using `startx`
or to `.xsession` to start Awesome using your display manager: or to `.xsession` to start Awesome using your display manager:
```sh
exec awesome exec awesome
```
In order to connect Awesome to a specific display, make sure that In order to connect Awesome to a specific display, make sure that
the `DISPLAY` environment variable is set correctly, e.g.: the `DISPLAY` environment variable is set correctly, e.g.:
```sh
DISPLAY=foo.bar:1 exec awesome DISPLAY=foo.bar:1 exec awesome
```
(This will start Awesome on display `:1` of the host foo.bar.) (This will start Awesome on display `:1` of the host foo.bar.)
@ -145,12 +94,16 @@ problem.
You can call `awesome` with `gdb` like this: You can call `awesome` with `gdb` like this:
```sh
DISPLAY=:2 gdb awesome DISPLAY=:2 gdb awesome
```
Then in `gdb` set any arguments and run it: Then in `gdb` set any arguments and run it:
```
(gdb) set args --replace (gdb) set args --replace
(gdb) run (gdb) run
```
## Asking questions ## Asking questions

View File

@ -0,0 +1,142 @@
# Building and Testing
## Dependencies
Awesome has the following dependencies (besides a more-or-less standard POSIX
environment):
- [CMake >= 3.0.0](https://cmake.org)
- [Lua >= 5.1.0](https://www.lua.org) or [LuaJIT](http://luajit.org)
- [LGI >= 0.8.0](https://github.com/pavouk/lgi)
- [xproto >= 7.0.15](https://www.x.org/archive//individual/proto/)
- [libxcb >= 1.6](https://xcb.freedesktop.org/) with support for the RandR, XTest, Xinerama, SHAPE and
XKB extensions
- [libxcb-cursor](https://xcb.freedesktop.org/)
- [libxcb-util >= 0.3.8](https://xcb.freedesktop.org/)
- [libxcb-keysyms >= 0.3.4](https://xcb.freedesktop.org/)
- [libxcb-icccm >= 0.3.8](https://xcb.freedesktop.org/)
- [libxcb-xfixes](https://xcb.freedesktop.org/)
- [xcb-util-xrm >= 1.0](https://github.com/Airblader/xcb-util-xrm)
- [libxkbcommon](http://xkbcommon.org/) with X11 support enabled
- [libstartup-notification >=
0.10](https://www.freedesktop.org/wiki/Software/startup-notification/)
- [cairo](https://www.cairographics.org/) with support for XCB and GObject
introspection
- [Pango](http://www.pango.org/) with support for Cairo and GObject
introspection
- [GLib >= 2.40](https://wiki.gnome.org/Projects/GLib) with support for GObject
introspection
- [GIO](https://developer.gnome.org/gio/stable/) with support for GObject
introspection
- [GdkPixbuf](https://wiki.gnome.org/Projects/GdkPixbuf)
- libX11 with xcb support
- [Imagemagick's convert utility](http://www.imagemagick.org/script/index.php)
- [libxdg-basedir >= 1.0.0](https://github.com/devnev/libxdg-basedir)
Additionally, the following optional dependencies exist:
- [DBus](https://www.freedesktop.org/wiki/Software/dbus/) for DBus integration
and the `awesome-client` utility
- [asciidoctor](https://asciidoctor.org/) for generating man pages
- [gzip](http://www.gzip.org/) for compressing man pages
- [ldoc >= 1.4.5](https://stevedonovan.github.io/ldoc/) for generating the
documentation
- [busted](https://olivinelabs.com/busted/) for running unit tests
- [luacheck](https://github.com/mpeterv/luacheck) for static code analysis
- [LuaCov](https://keplerproject.github.io/luacov/) for collecting code coverage
information
- libexecinfo on systems where libc does not provide `backtrace_symbols()` to
generate slightly better backtraces on crashes
- `Xephyr` or `Xvfb` for running integration tests
- [GTK+ >= 3.10](https://www.gtk.org/) for `./themes/gtk/`
- [xcb-errors](https://gitlab.freedesktop.org/xorg/lib/libxcb-errors) for
pretty-printing of X11 errors
- [libRSVG](https://wiki.gnome.org/action/show/Projects/LibRsvg) for displaying
SVG files without scaling artifacts
- [wmctrl](http://tripie.sweb.cz/utils/wmctrl) for testing WM interactions
with external actions
- [xterm](https://invisible-island.net/xterm/) for various test cases
## Building
With all dependencies installed, run the following commands within the root of the repository to build and install Awesome on your system:
```sh
make
sudo make install
```
### Create packages
To ease installation management, you can pack Awesome into `.deb` or `.rpm` packages. The following command will build the correct package for your system's package manager:
```sh
make package
```
To install the package, run one of the following commands:
```sh
sudo dpkg -i awesome-x.y.z.deb
# or
sudo rpm -Uvh awesome-x.y.z.rpm
```
### Customizing build options
Awesome allows customizing various aspects of the build process through CMake variables. To change these variables, pass the `CMAKE_ARGS` environment variable to `make` with CMake flags as content (see `cmake -h`).
Here is an example:
```sh
CMAKE_ARGS="-DLUA_EXECUTABLE=/usr/bin/lua5.3" make
```
**Note:**
CMake arguments only need to be specified on the first run of `make` or after `make distclean`.
#### Skip documentation
The CMake variables `GENERATE_DOC` and `GENERATE_MANPAGES` toggle generation of HTML documentation and man pages respectively. They are enabled by default but can be set to `OFF`.
```sh
CMAKE_ARGS="-DGENERATE_DOC=OFF -DGENERATE_MANPAGES=OFF" make
```
#### Change the Lua version
Both the build steps and the final binary require a working Lua interpreter. To change the Lua interpreter that both the build process and Awesome should use, specify an absolute path to a `lua` binary for `LUA_EXECUTABLE` and values that match the binary's version for `LUA_LIBRARY` and `LUA_INCLUDE_DIR`.
Example to build on Arch Linux:
```sh
CMAKE_ARGS="-DLUA_EXECUTABLE=/usr/bin/lua5.3 -DLUA_LIBRARY=/usr/lib/liblua.so.5.3 -DLUA_INCLUDE_DIR=/usr/include/lua5.3" make
```
#### Additional options
Additional variables can be found through CMake. Run the following command to print a list of all available variables, including the ones explained above:
```sh
cmake -B build -L
```
## Testing
Once Awesome has been built, you can run various test suites to verify functionality for both the binary and the Lua library. Make sure to install applicable dependencies as outlined at the top.
**Full test suite:**
```sh
make check
```
Individual test categories can be run as well:
* `make check-integration`: Run integration tests within a Xephyr session.
* `make check-qa`: Run `luacheck` against the Lua library
* `make check-unit`: Run unit tests with `busted` against the Lua library. You can also run `busted <options> ./spec` if you want to specify options for `busted`.
* `make check-requires`: Check for invalid `require()` calls.
* `make check-examples`: Run integration tests within the examples in `./tests/examples`.
* `make check-themes`: Test themes.

View File

@ -83,6 +83,7 @@ topics={
'07-my-first-awesome.md', '07-my-first-awesome.md',
'08-client-layout-system.md', '08-client-layout-system.md',
'09-options.md', '09-options.md',
'10-building-and-testing.md',
'16-using-cairo.md', '16-using-cairo.md',
'17-porting-tips.md', '17-porting-tips.md',
'90-FAQ.md', '90-FAQ.md',

View File

@ -1,5 +1,10 @@
local spawn = require("awful.spawn") local spawn = require("awful.spawn")
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
end
-- This file provide a simple, yet flexible, test client. -- This file provide a simple, yet flexible, test client.
-- It is used to test the `ruled.client` -- It is used to test the `ruled.client`
@ -106,7 +111,7 @@ local pipe
local function init() local function init()
if initialized then return end if initialized then return end
initialized = true initialized = true
local cmd = { "lua", "-e", test_client_source } local cmd = { lua_executable, "-e", test_client_source }
local _, _, stdin, stdout, stderr = awesome.spawn(cmd, false, true, true, true) local _, _, stdin, stdout, stderr = awesome.spawn(cmd, false, true, true, true)
pipe = Gio.UnixOutputStream.new(stdin, true) pipe = Gio.UnixOutputStream.new(stdin, true)
stdout = Gio.UnixInputStream.new(stdout, true) stdout = Gio.UnixInputStream.new(stdout, true)

View File

@ -17,7 +17,7 @@ endif()
cmake_minimum_required(VERSION 3.0.0) cmake_minimum_required(VERSION 3.0.0)
# Get and update the LUA_PATH so the scripts can be executed without awesome. # Get and update the LUA_PATH so the scripts can be executed without awesome.
execute_process(COMMAND lua -e "p = package.path:gsub(';', '\\\\;'); io.stdout:write(p)" execute_process(COMMAND ${LUA_EXECUTABLE} -e "p = package.path:gsub(';', '\\\\;'); io.stdout:write(p)"
OUTPUT_VARIABLE "LUA_PATH_") OUTPUT_VARIABLE "LUA_PATH_")
# Allow to use the example tests by themselves. # Allow to use the example tests by themselves.
@ -32,7 +32,7 @@ endif()
if (DO_COVERAGE) if (DO_COVERAGE)
execute_process( execute_process(
COMMAND env "SOURCE_DIRECTORY=${TOP_SOURCE_DIR}" lua -e "require('luacov.runner')('${TOP_SOURCE_DIR}/.luacov')" COMMAND env "SOURCE_DIRECTORY=${TOP_SOURCE_DIR}" ${LUA_EXECUTABLE} -e "require('luacov.runner')('${TOP_SOURCE_DIR}/.luacov')"
RESULT_VARIABLE TEST_RESULT RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_ERROR ERROR_VARIABLE TEST_ERROR
ERROR_STRIP_TRAILING_WHITESPACE) ERROR_STRIP_TRAILING_WHITESPACE)
@ -40,9 +40,9 @@ if (DO_COVERAGE)
message(${TEST_ERROR}) message(${TEST_ERROR})
message(FATAL_ERROR "Failed to run luacov.runner.") message(FATAL_ERROR "Failed to run luacov.runner.")
endif() endif()
set(LUA_COV_RUNNER lua "-erequire('luacov.runner')('${TOP_SOURCE_DIR}/.luacov')") set(LUA_COV_RUNNER ${LUA_EXECUTABLE} "-erequire('luacov.runner')('${TOP_SOURCE_DIR}/.luacov')")
else() else()
set(LUA_COV_RUNNER lua) set(LUA_COV_RUNNER ${LUA_EXECUTABLE})
endif() endif()
if (STRICT_TESTS) if (STRICT_TESTS)

View File

@ -8,6 +8,11 @@ local lgi = require("lgi")
local Gio = lgi.Gio local Gio = lgi.Gio
local GdkPixbuf = lgi.GdkPixbuf local GdkPixbuf = lgi.GdkPixbuf
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
end
local header = [[ local header = [[
local lgi = require("lgi") local lgi = require("lgi")
local Gdk = lgi.Gdk local Gdk = lgi.Gdk
@ -48,7 +53,7 @@ runner.run_steps{
-- Clear the clipboard to get to a known state -- Clear the clipboard to get to a known state
function() function()
spawn.with_line_callback({ "lua", "-e", acquire_and_clear_clipboard }, spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end }) { exit = function() continue = true end })
return true return true
end, end,
@ -79,7 +84,7 @@ runner.run_steps{
-- Now set the clipboard to some text -- Now set the clipboard to some text
continue = false continue = false
spawn.with_line_callback({ "lua", "-e", acquire_clipboard_text }, spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_text },
{ stdout = function(line) { stdout = function(line)
assert(line == "initialisation done", assert(line == "initialisation done",
"Unexpected line: " .. line) "Unexpected line: " .. line)
@ -143,7 +148,7 @@ runner.run_steps{
-- Now set the clipboard to an image -- Now set the clipboard to an image
continue = false continue = false
spawn.with_line_callback({ "lua", "-e", acquire_clipboard_pixbuf }, spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_pixbuf },
{ stdout = function(line) { stdout = function(line)
assert(line == "initialisation done", assert(line == "initialisation done",
"Unexpected line: " .. line) "Unexpected line: " .. line)

View File

@ -3,6 +3,11 @@
local runner = require("_runner") local runner = require("_runner")
local spawn = require("awful.spawn") local spawn = require("awful.spawn")
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
end
-- Assemble data for the large transfer that will be done later -- Assemble data for the large transfer that will be done later
local large_transfer_piece = "a" local large_transfer_piece = "a"
for _ = 1, 25 do for _ = 1, 25 do
@ -86,7 +91,7 @@ runner.run_steps({
end end
end) end)
awesome.sync() awesome.sync()
spawn.with_line_callback({ "lua", "-e", check_targets_and_text }, spawn.with_line_callback({ lua_executable, "-e", check_targets_and_text },
{ stdout = function(line) { stdout = function(line)
assert(line == "done", "Unexpected line: " .. line) assert(line == "done", "Unexpected line: " .. line)
continue = true continue = true
@ -124,7 +129,7 @@ runner.run_steps({
end end
end) end)
awesome.sync() awesome.sync()
spawn.with_line_callback({ "lua", "-e", check_targets_and_text }, spawn.with_line_callback({ lua_executable, "-e", check_targets_and_text },
{ stdout = function(line) { stdout = function(line)
assert(line == "done", "Unexpected line: " .. line) assert(line == "done", "Unexpected line: " .. line)
continue = true continue = true
@ -161,7 +166,7 @@ runner.run_steps({
end end
end) end)
awesome.sync() awesome.sync()
spawn.with_line_callback({ "lua", "-e", check_large_transfer }, spawn.with_line_callback({ lua_executable, "-e", check_large_transfer },
{ stdout = function(line) { stdout = function(line)
assert(line == "done", "Unexpected line: " .. line) assert(line == "done", "Unexpected line: " .. line)
continue = true continue = true
@ -177,7 +182,7 @@ runner.run_steps({
-- Now test that :release() works -- Now test that :release() works
selection_object:release() selection_object:release()
awesome.sync() awesome.sync()
spawn.with_line_callback({ "lua", "-e", check_empty_selection }, spawn.with_line_callback({ lua_executable, "-e", check_empty_selection },
{ stdout = function(line) { stdout = function(line)
assert(line == "done", "Unexpected line: " .. line) assert(line == "done", "Unexpected line: " .. line)
continue = true continue = true
@ -196,7 +201,7 @@ runner.run_steps({
"Failed to acquire the clipboard selection") "Failed to acquire the clipboard selection")
selection_object:connect_signal("release", function() selection_released = true end) selection_object:connect_signal("release", function() selection_released = true end)
awesome.sync() awesome.sync()
spawn.with_line_callback({ "lua", "-e", acquire_and_clear_clipboard }, spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end }) { exit = function() continue = true end })
return true return true
end, end,

View File

@ -3,6 +3,11 @@
local runner = require("_runner") local runner = require("_runner")
local spawn = require("awful.spawn") local spawn = require("awful.spawn")
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
end
local header = [[ local header = [[
local lgi = require("lgi") local lgi = require("lgi")
local Gdk = lgi.Gdk local Gdk = lgi.Gdk
@ -62,7 +67,7 @@ runner.run_steps{
-- Clear the clipboard to get to a known state -- Clear the clipboard to get to a known state
function() function()
check_state(0, 0) check_state(0, 0)
spawn.with_line_callback({ "lua", "-e", acquire_and_clear_clipboard }, spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end }) { exit = function() continue = true end })
return true return true
end, end,
@ -81,7 +86,7 @@ runner.run_steps{
-- Set the clipboard -- Set the clipboard
continue = false continue = false
spawn.with_line_callback({ "lua", "-e", acquire_clipboard }, spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard },
{ stdout = function(line) { stdout = function(line)
assert(line == "initialisation done", assert(line == "initialisation done",
"Unexpected line: " .. line) "Unexpected line: " .. line)
@ -100,7 +105,7 @@ runner.run_steps{
-- Now clear the clipboard again -- Now clear the clipboard again
continue = false continue = false
spawn.with_line_callback({ "lua", "-e", acquire_and_clear_clipboard }, spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end }) { exit = function() continue = true end })
return true return true

View File

@ -3,6 +3,11 @@
local runner = require("_runner") local runner = require("_runner")
local spawn = require("awful.spawn") local spawn = require("awful.spawn")
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
end
local spawns_done = 0 local spawns_done = 0
local async_spawns_done = 0 local async_spawns_done = 0
local exit_yay, exit_snd = nil, nil local exit_yay, exit_snd = nil, nil
@ -11,7 +16,7 @@ local exit_yay, exit_snd = nil, nil
-- * spawn with startup notification is covered by test-spawn-snid.lua -- * spawn with startup notification is covered by test-spawn-snid.lua
local tiny_client = function(class) local tiny_client = function(class)
return {"lua", "-e", [[ return { lua_executable, "-e", [[
local lgi = require 'lgi' local lgi = require 'lgi'
local Gtk = lgi.require('Gtk') local Gtk = lgi.require('Gtk')
local class = ']]..class..[[' local class = ']]..class..[['

View File

@ -4,6 +4,11 @@ local rules = require("ruled.client")
local spawn = require("awful.spawn") local spawn = require("awful.spawn")
local gdebug = require("gears.debug") local gdebug = require("gears.debug")
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
end
local tiny_client_code_template = [[ local tiny_client_code_template = [[
pcall(require, 'luarocks.loader') pcall(require, 'luarocks.loader')
local Gtk, class = require('lgi').require('Gtk'), 'client' local Gtk, class = require('lgi').require('Gtk'), 'client'
@ -18,8 +23,8 @@ function app:on_activate()
end end
app:run {''} app:run {''}
]] ]]
local tiny_client = {"lua", "-e", string.format(tiny_client_code_template, "")} local tiny_client = { lua_executable, "-e", string.format(tiny_client_code_template, "") }
local tiny_client_undecorated = {"lua", "-e", local tiny_client_undecorated = { lua_executable, "-e",
string.format(tiny_client_code_template, [[ string.format(tiny_client_code_template, [[
window.decorated = false window.decorated = false
]]) ]])