branch: elpa/org-drill
commit 20c90836aa10045db330699439416197df9fc761
Author: Phillip Lord <[email protected]>
Commit: Phillip Lord <[email protected]>

    Speed up robot tests with polling
---
 robot/all-card-run.sh |  1 -
 robot/basic-run.sh    |  4 +---
 robot/leitner-run.sh  |  1 -
 robot/robot.sh        | 18 ++++++++++++------
 robot/spanish-run.sh  |  1 -
 5 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/robot/all-card-run.sh b/robot/all-card-run.sh
index 3d70fc0dbb..059f7d4a79 100755
--- a/robot/all-card-run.sh
+++ b/robot/all-card-run.sh
@@ -31,7 +31,6 @@ function run_drill {
 launch_emacs $this_dir/all-card-run.el $card_no
 
 {
-    sleep 1
     find_bot
 
     ## Run once with default options
diff --git a/robot/basic-run.sh b/robot/basic-run.sh
index 9e0d69cfa5..0eb5d1137c 100755
--- a/robot/basic-run.sh
+++ b/robot/basic-run.sh
@@ -5,7 +5,7 @@ set -e
 function run_drill {
     ## Org-drill should be running at this point, so give three answers
     ## with a score of file
-    sleep_big
+    sleep_small
 
     echo answer one
     send_answer
@@ -19,7 +19,6 @@ function run_drill {
     ## Press any key to continue
     echo press any key to continue
     retn
-    sleep_small
 
     echo Save file
     key y
@@ -32,7 +31,6 @@ source $this_dir/robot.sh
 launch_emacs $this_dir/basic-run.el
 
 {
-    sleep 1
     find_bot
 
     ## Run once with default options
diff --git a/robot/leitner-run.sh b/robot/leitner-run.sh
index d91dd78fd8..270d7435d5 100755
--- a/robot/leitner-run.sh
+++ b/robot/leitner-run.sh
@@ -25,7 +25,6 @@ source $this_dir/robot.sh
 launch_emacs $this_dir/leitner-run.el
 
 {
-    sleep 1
     find_bot
 
     ## Run once with default options
diff --git a/robot/robot.sh b/robot/robot.sh
index 8b7e9a31fd..c5cc33da5b 100644
--- a/robot/robot.sh
+++ b/robot/robot.sh
@@ -69,10 +69,16 @@ function wait_emacs {
 }
 
 function find_bot {
-    window_id=`xdotool search --name "emacs-bot"`
-    if [ -z "$window_id" ]
-    then
-        echo "Could not find window ID for Emacs-bot"
-        exit 1
-    fi
+    for i in `seq 1 20`;
+    do
+        window_id=`xdotool search --name "emacs-bot"`
+        if [ -z "$window_id" ]
+        then
+            sleep 0.1
+        else
+            return
+        fi
+    done
+    echo "Could not find window ID for Emacs-bot"
+    exit 1
 }
diff --git a/robot/spanish-run.sh b/robot/spanish-run.sh
index c8cf19ad11..9f20c08ae0 100755
--- a/robot/spanish-run.sh
+++ b/robot/spanish-run.sh
@@ -31,7 +31,6 @@ function run_drill {
 launch_emacs $this_dir/spanish-run.el
 
 {
-    sleep 1
     find_bot
 
     ## Run once with default options

Reply via email to