diff options
| author | Phillip Lord <phillip.lord@russet.org.uk> | 2019-06-15 12:29:52 +0100 |
|---|---|---|
| committer | Phillip Lord <phillip.lord@russet.org.uk> | 2019-06-15 12:29:52 +0100 |
| commit | 6c14bd6c5079bfb384134f4275a5f289f92e4ab5 (patch) | |
| tree | fd12aab22755850bb37c460a4dd488acb3cbd7cb /robot | |
| parent | 507daae5a2ece2ec15a3f45a7ac0d88939b48852 (diff) | |
| download | org-drill-6c14bd6c5079bfb384134f4275a5f289f92e4ab5.tar.gz org-drill-6c14bd6c5079bfb384134f4275a5f289f92e4ab5.zip | |
Update robot, Fix remaining CL dependencies
The robot test now includes "with-typing" input. This uncovered some
more usages of cl.el which are now gone.
Diffstat (limited to 'robot')
| -rw-r--r-- | robot/org-drill-launch.el | 41 | ||||
| -rwxr-xr-x | robot/robot-test.sh | 105 |
2 files changed, 95 insertions, 51 deletions
diff --git a/robot/org-drill-launch.el b/robot/org-drill-launch.el index 85f23ff..2de9219 100644 --- a/robot/org-drill-launch.el +++ b/robot/org-drill-launch.el @@ -6,26 +6,53 @@ ;; Clean up (delete-file (concat top-dir "robot/failure.txt")) +(delete-file (concat top-dir "robot/messages.txt")) (set-frame-name "emacs-bot") (setq debug-on-error t) (setq debug-on-quit t) +(defun dump-buffer (buffer file) + (save-excursion + (when (get-buffer buffer) + (set-buffer buffer) + (write-region (point-min) (point-max) + (concat top-dir "robot/" file) + nil 'dont-display-wrote-file-message + )))) + (add-hook 'debugger-mode-hook 'org-drill-launcher-dump-in-a-bit) + (defun org-drill-launcher-dump-in-a-bit () (run-with-timer 1 nil #'org-drill-launcher-dump)) +(defun org-drill-dump-messages () + (dump-buffer "*Messages*" "messages.txt")) + +(run-with-timer 1 1 #'org-drill-dump-messages) + + (defun org-drill-launcher-dump () - (save-excursion - (set-buffer "*Backtrace*") - (write-region (point-min) (point-max) (concat top-dir "robot/failure.txt"))) - (kill-emacs)) + (dump-buffer "*Backtrace*" "failure.txt") + (dump-buffer "*Messages*" "messages.txt") + (kill-emacs -1)) (load-file "org-drill.el") -(copy-file "robot/main-test.org" "robot/main-test-copy.org" t) -(find-file "robot/main-test-copy.org") +(defun org-drill-do-drill () + (copy-file "robot/main-test.org" "robot/main-test-copy.org" t) + (find-file "robot/main-test-copy.org") + + (org-drill) + (set-buffer-modified-p nil) + (kill-buffer)) + +(org-drill-do-drill) + +(message "First drill complete") + +(setq org-drill-presentation-prompt-with-typing t) -(org-drill) +(org-drill-do-drill) diff --git a/robot/robot-test.sh b/robot/robot-test.sh index 31a6f09..c27b94b 100755 --- a/robot/robot-test.sh +++ b/robot/robot-test.sh @@ -1,49 +1,66 @@ -#!/bin/sh +#!/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 1 - -window_id=`xdotool search --name "emacs-bot"` -if [ -z "$window_id" ] -then - echo "Could not find window ID for Emacs-bot" - exit 1 -fi - -## Org-drill should be running at this point, so give three answers -## with a score of file -echo answer one -xdotool key --window $window_id KP_Enter -sleep 0.25 -xdotool key --window $window_id 5 -sleep 0.25 - - -echo answer two -xdotool key --window $window_id KP_Enter -sleep 0.25 -xdotool key --window $window_id 5 -sleep 0.25 - -echo answer three -xdotool key --window $window_id KP_Enter -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 KP_Enter -sleep 0.25 - -echo Save file -xdotool key --window $window_id y -sleep 0.25 - -echo Goodnight Emacs -xdotool key --window $window_id alt+x -xdotool type --window $window_id kill-emacs -xdotool key --window $window_id KP_Enter +{ + 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 |
