[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-drill be851b9eb4 142/251: Refactor robot testing
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-drill be851b9eb4 142/251: Refactor robot testing |
Date: |
Mon, 17 Jan 2022 18:59:10 -0500 (EST) |
branch: elpa/org-drill
commit be851b9eb42faa3c096737daaab0afcbc8c5087e
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Phillip Lord <phillip.lord@russet.org.uk>
Refactor robot testing
---
Makefile | 8 ++--
robot/{org-drill-launch.el => basic-run.el} | 8 +++-
robot/basic-run.sh | 49 +++++++++++++++++++++
robot/robot-test.sh | 66 -----------------------------
robot/robot.sh | 56 ++++++++++++++++++++++++
5 files changed, 116 insertions(+), 71 deletions(-)
diff --git a/Makefile b/Makefile
index ea827e67a7..b5da6388fb 100644
--- a/Makefile
+++ b/Makefile
@@ -7,14 +7,14 @@ ifdef EMACS
EMACS_ENV=EMACS=$(EMACS)
endif
-all:
+all: robot-and-test
install:
$(EMACS_ENV) $(CASK) install
test: install just-test
-robot-and-test: robot-test just-test
+robot-and-test: basic-robot-test just-test
just-test:
$(EMACS_ENV) $(CASK) emacs --batch -q \
@@ -35,8 +35,8 @@ docker-test:
$(MAKE) test-git DOCKER_TAG=25.3
$(MAKE) test-cp DOCKER_TAG=25.3
-robot-test:
+basic-robot-test:
$(CASK) clean-elc
- $(EMACS_ENV) ./robot/robot-test.sh
+ $(EMACS_ENV) ./robot/basic-run.sh
.PHONY: test
diff --git a/robot/org-drill-launch.el b/robot/basic-run.el
similarity index 94%
rename from robot/org-drill-launch.el
rename to robot/basic-run.el
index 2de92197bc..1469fef4bb 100644
--- a/robot/org-drill-launch.el
+++ b/robot/basic-run.el
@@ -13,6 +13,11 @@
(setq debug-on-error t)
(setq debug-on-quit t)
+(defun die ()
+ (interactive)
+ (kill-emacs)
+ )
+
(defun dump-buffer (buffer file)
(save-excursion
(when (get-buffer buffer)
@@ -37,7 +42,8 @@
(defun org-drill-launcher-dump ()
(dump-buffer "*Backtrace*" "failure.txt")
(dump-buffer "*Messages*" "messages.txt")
- (kill-emacs -1))
+ (kill-emacs -1)
+ )
(load-file "org-drill.el")
diff --git a/robot/basic-run.sh b/robot/basic-run.sh
new file mode 100755
index 0000000000..497f1579c1
--- /dev/null
+++ b/robot/basic-run.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -e
+
+function run_drill {
+ ## Org-drill should be running at this point, so give three answers
+ ## with a score of file
+ sleep_big
+
+ echo answer one
+ send_answer
+
+ echo answer two
+ send_answer
+
+ echo answer three
+ send_answer
+
+ ## Press any key to continue
+ echo press any key to continue
+ retn
+ sleep_small
+
+ echo Save file
+ key y
+}
+
+this_dir="$(dirname "$0")"
+source $this_dir/robot.sh
+
+
+launch_emacs $this_dir/basic-run.el
+
+bsmall_sleep=5
+big_sleep=10
+
+{
+ sleep 2
+ find_bot
+
+ ## Run once with default options
+ run_drill
+
+ ## Run once with presentation-prompt-with-typing
+ run_drill
+
+ # kill_emacs
+} || cat robot/failure.txt
+ $EMACS -Q -l $1 &
diff --git a/robot/robot-test.sh b/robot/robot-test.sh
deleted file mode 100755
index c27b94bb5c..0000000000
--- a/robot/robot-test.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-
-set -e
-
-function run_drill {
- ## Org-drill should be running at this point, so give three answers
- ## with a score of file
- sleep 1
- echo answer one
- #xdotool type --window $window_id answer
- xdotool key --window $window_id Return
- sleep 0.25
- xdotool key --window $window_id 5
- sleep 0.25
-
-
- echo answer two
- #xdotool type --window $window_id answer
- xdotool key --window $window_id Return
- sleep 0.25
- xdotool key --window $window_id 5
- sleep 0.25
-
- echo answer three
- #xdotool type --window $window_id answer
- xdotool key --window $window_id Return
- sleep 0.25
- xdotool key --window $window_id 5
- sleep 0.25
-
- ## Press any key to continue
- echo press any key to continue
- xdotool key --window $window_id Return
- sleep 0.25
-
- echo Save file
- xdotool key --window $window_id y
-}
-
-function kill_emacs {
- echo Goodnight Emacs
- xdotool key --window $window_id alt+x
- xdotool type --window $window_id kill-emacs
- xdotool key --window $window_id KP_Enter
-}
-
-$EMACS -Q -l ./robot/org-drill-launch.el &
-
-{
- sleep 2
-
- window_id=`xdotool search --name "emacs-bot"`
- if [ -z "$window_id" ]
- then
- echo "Could not find window ID for Emacs-bot"
- exit 1
- fi
-
- ## Run once with default options
- run_drill
-
- ## Run once with presentation-prompt-with-typing
- run_drill
-
- kill_emacs
-} || cat robot/failure.txt
diff --git a/robot/robot.sh b/robot/robot.sh
new file mode 100644
index 0000000000..e013308351
--- /dev/null
+++ b/robot/robot.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+## call find_bot to init this
+window_id=
+
+## This is the small sleep between key presses. Change for debugging
+## when you are not sure what is happening
+small_sleep=0.25
+big_sleep=1
+
+function sleep_small {
+ sleep $small_sleep
+}
+
+function sleep_big {
+ sleep $big_sleep
+}
+
+function send_answer {
+ retn
+ sleep_small
+ key 5
+ sleep_small
+}
+
+function launch_emacs {
+ echo Launching $EMACS -Q -l $1 &
+ $EMACS -Q -l $1 &
+}
+
+function kill_emacs {
+ key alt+x
+ command kill-emacs
+ retn
+}
+
+function key {
+ xdotool key --window $window_id $1
+}
+
+function command {
+ xdotool type --window $window_id $1
+}
+
+function retn {
+ xdotool key --window $window_id Return
+}
+
+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
+}
- [nongnu] elpa/org-drill 17c34adec5 028/251: - At the end of a drill session, when re-presenting items that were failed, (continued)
- [nongnu] elpa/org-drill 17c34adec5 028/251: - At the end of a drill session, when re-presenting items that were failed, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 2be993c6ce 037/251: Don't warn about a high percentage of failed items when the number of tested, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 849be174b6 093/251: Added tag 2.4.10 for changeset 2d622b26469c, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 44289690b7 089/251: Added tag 2.4.9 for changeset 355c05642208, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill ddd9b056cd 106/251: Merge answer typing, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill a9d771052e 107/251: Fix matching of lock files, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 4d9bdb6836 115/251: Add org-learn, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 939f2a65b2 114/251: Enable cask testing, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 533a3a84ee 117/251: Add gitlab-ci.yml, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 54cde2dbf7 132/251: Move to eieio objects, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill be851b9eb4 142/251: Refactor robot testing,
ELPA Syncer <=
- [nongnu] elpa/org-drill 1470bdb487 131/251: Remove org-drill-new-entries, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 50885fbeea 146/251: Refactor robot testing to allow multiple tests, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c58cb90ff0 123/251: Update gitignore, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 644b0a5cbc 126/251: Remove org-learn as a separate package, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 9aa3e98ea0 130/251: Remove org-drill-start-time, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill b161277f82 156/251: Replace more non-namespaced commands, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 61fe47deb8 152/251: Replace drill-answer, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 02b507b839 151/251: Add leitner robot test and fix, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 6533b73246 164/251: Support changing small sleep on command line, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill a949ece724 165/251: Remove more dynamic scoping errors, ELPA Syncer, 2022/01/17