Skip to content

Instantly share code, notes, and snippets.

@psychon
Created July 19, 2015 14:30
Show Gist options
  • Save psychon/f9f556889a30359ed83d to your computer and use it in GitHub Desktop.
Save psychon/f9f556889a30359ed83d to your computer and use it in GitHub Desktop.
diff --git a/tests/run.sh b/tests/run.sh
index 5ed9f7b..5f0bf97 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -36,6 +36,7 @@ XEPHYR=Xephyr
XVFB=Xvfb
AWESOME=$root_dir/build/awesome
RC_FILE=$root_dir/build/awesomerc.lua
+AWESOME_CLIENT="$root_dir/utils/awesome-client"
D=:5
SIZE=1024x768
@@ -62,24 +63,28 @@ XDG_CONFIG_HOME="./"
export LUA_PATH
export XDG_CONFIG_HOME
-awesome_log=/tmp/_awesome_test.log
-echo "awesome_log: $awesome_log"
-
cd - >/dev/null
-
-kill_childs() {
+# Cleanup on errors / aborting.
+cleanup() {
for p in $awesome_pid $xserver_pid; do
kill -TERM $p 2>/dev/null || true
done
+ rm -rf $tmp_files || true
}
-# Cleanup on errors / aborting.
-set_trap() {
- trap "kill_childs" 0 2 3 15
-}
-set_trap
+trap "cleanup" 0 2 3 15
-AWESOME_CLIENT="$root_dir/utils/awesome-client"
+tmp_files=$(mktemp -d)
+awesome_log=$tmp_files/_awesome_test.log
+echo "awesome_log: $awesome_log"
+
+# Prepare a config files pointing to a working theme
+RC_FILE=$tmp_files/awesomerc.lua
+THEME_FILE=$tmp_files/theme.lua
+sed -e "s:beautiful.init(\"@AWESOME_THEMES_PATH@/default/theme.lua\"):beautiful.init('$THEME_FILE'):" $root_dir/awesomerc.lua > $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 > $THEME_FILE
# Start awesome.
start_awesome() {
diff --git a/tests/test-urgent.lua b/tests/test-urgent.lua
index c33f01c..a9b3cf2 100644
--- a/tests/test-urgent.lua
+++ b/tests/test-urgent.lua
@@ -46,7 +46,11 @@ local steps = {
function(count)
if count == 1 then
-- Setup: switch to tag.
- os.execute('xdotool key super+2')
+ root.fake_input("key_press", 133)
+ root.fake_input("key_press", 11)
+ root.fake_input("key_release", 11)
+ root.fake_input("key_release", 133)
+ --os.execute('xdotool key super+2')
elseif awful.tag.selectedlist()[1] == tags[1][2] then
assert(#client.get() == 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment