emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pacmacs ffc0195b9a 346/472: Merge pull request #176 from c


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs ffc0195b9a 346/472: Merge pull request #176 from codingteam/refactor-it-recorder
Date: Thu, 6 Jan 2022 21:59:38 -0500 (EST)

branch: elpa/pacmacs
commit ffc0195b9ab1c62791d520b0bb0226f7137e69ea
Merge: 84598f8f20 3e25c67590
Author: Alexey Kutepov <reximkut@gmail.com>
Commit: Alexey Kutepov <reximkut@gmail.com>

    Merge pull request #176 from codingteam/refactor-it-recorder
    
    Semi-automatic ATT measuring
---
 tools/README.md                         | 10 +++++--
 tools/att.el                            | 17 +++++++++++
 tools/{it-recorder.el => pacmacs-rr.el} | 53 +++++++++++++++++++++++++++++----
 3 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/tools/README.md b/tools/README.md
index a19b055937..299e60f774 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -2,11 +2,17 @@
 
 Tools that help to develop the game
 
+## att.el ##
+
+Runs `./it-cases/it-case03.el` it case using `pacmacs-rr` module and
+outputs the ATT to `./att.txt` file.
+
 ## compile.el ##
 
 Compiles all the source code, treats warnings as errors and exits with
 non-zero exit code on any error (which `cask build` does not yet).
 
-## it-recorder.el ##
+## pacmacs-rr.el ##
 
-Tool for recording and replaying integration test cases.
+RR stands for Record and Replay. Additional module for recording and
+replaying integration test cases.
diff --git a/tools/att.el b/tools/att.el
new file mode 100644
index 0000000000..8a3902c68e
--- /dev/null
+++ b/tools/att.el
@@ -0,0 +1,17 @@
+(add-to-list 'load-path default-directory)
+(add-to-list 'load-path (concat default-directory "/tools/"))
+
+(require 'pacmacs-rr)
+(require 'f)
+
+(defconst att-result-file-path "./att.txt")
+(defvar att-it-case-path "./it-cases/it-case03.el")
+
+(defun att-replayer-finished ()
+  (f-write (format "Average Tick Time: %fms" (pacmacs--average-tick-time))
+           'utf-8
+           att--result-file-path)
+  (kill-emacs 0))
+
+(add-hook 'pacmacs-replay-finished-hook #'performance-replayer-finished)
+(pacmacs--start-it-replayer att-it-case-path)
diff --git a/tools/it-recorder.el b/tools/pacmacs-rr.el
similarity index 56%
rename from tools/it-recorder.el
rename to tools/pacmacs-rr.el
index fa5a73bf9e..b673e112e4 100644
--- a/tools/it-recorder.el
+++ b/tools/pacmacs-rr.el
@@ -1,3 +1,38 @@
+;;; pacmacs-rr.el --- Pacman for Emacs -*- lexical-binding: t -*-
+
+;; Copyright (C) 2015 Codingteam
+
+;; Author: Codingteam <codingteam@conference.jabber.ru>
+;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
+;; URL: http://github.com/rexim/pacmacs.el
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Additional module for recording and replaying integration test
+;; cases.
+
+;;; Code:
+
 (require 'pacmacs)
 
 (require 'dash)
@@ -7,6 +42,7 @@
 (defvar pacmacs--tick-counter 0)
 (defvar pacmacs--recorded-actions nil)
 (defvar pacmacs--tick-times nil)
+(defvar pacmacs-replay-finished-hook nil)
 
 (defun pacmacs--record-action (action-name)
   (add-to-list 'pacmacs--recorded-actions
@@ -62,12 +98,13 @@
                (pacmacs--measure-time
                 (pacmacs-tick)))
 
-  (if (not pacmacs--recorded-actions)
-      (pacmacs-quit)
-    (-let ((((action . tick-number) . _) pacmacs--recorded-actions))
-      (when (= tick-number pacmacs--tick-counter)
-        (funcall action)
-        (setq pacmacs--recorded-actions (cdr pacmacs--recorded-actions))))))
+  (if pacmacs--recorded-actions
+      (-let ((((action . tick-number) . _) pacmacs--recorded-actions))
+        (when (= tick-number pacmacs--tick-counter)
+          (funcall action)
+          (setq pacmacs--recorded-actions (cdr pacmacs--recorded-actions))))
+    (pacmacs-quit)
+    (run-hooks 'pacmacs-replay-finished-hook)))
 
 (define-derived-mode pacmacs-it-recorder-mode pacmacs-mode 
"pacmacs-it-recorder-mode"
   (define-key pacmacs-it-recorder-mode-map (kbd "<up>") 'pacmacs-record-up)
@@ -92,3 +129,7 @@
   (setq pacmacs--recorded-actions (pacmacs--load-test-case filename))
   (setq pacmacs--tick-counter 0)
   (setq pacmacs--tick-times nil))
+
+(provide 'pacmacs-rr)
+
+;;; pacmacs-rr.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]