summaryrefslogtreecommitdiffstats
path: root/tools/emacs/trybot.el
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 23:34:46 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 23:34:46 +0000
commit15e4d5b043a37988f7e82e8b00287d90acf8787e (patch)
tree630218701d8ff66b8fd56ec063c09ca628e6c7d6 /tools/emacs/trybot.el
parenta3c6262246851b00bd5ad315330359de8d341b84 (diff)
downloadchromium_src-15e4d5b043a37988f7e82e8b00287d90acf8787e.zip
chromium_src-15e4d5b043a37988f7e82e8b00287d90acf8787e.tar.gz
chromium_src-15e4d5b043a37988f7e82e8b00287d90acf8787e.tar.bz2
emacs: use curl to fetch trybot output, improve mac performance
By using a command to fetch trybot output, we can pipe the result through a sed script that trims down the Mac output. This makes the output small enough so that compilation-mode can handle it. While I'm at it, I can use file:/// URLs to unify more of the "real" and "test" code paths. Review URL: http://codereview.chromium.org/5737005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69069 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/emacs/trybot.el')
-rw-r--r--tools/emacs/trybot.el56
1 files changed, 39 insertions, 17 deletions
diff --git a/tools/emacs/trybot.el b/tools/emacs/trybot.el
index 784241d..b3820df 100644
--- a/tools/emacs/trybot.el
+++ b/tools/emacs/trybot.el
@@ -85,17 +85,46 @@
(compilation-mode))
+(defun trybot-get-new-buffer ()
+ "Get a new clean buffer for trybot output."
+ ; Use trybot-buffer-name if available; otherwise, "*trybot*".
+ (let ((buffer-name (if (boundp 'trybot-buffer-name)
+ trybot-buffer-name
+ "*trybot*")))
+ (let ((old (get-buffer buffer-name)))
+ (when old (kill-buffer old)))
+ (get-buffer-create buffer-name)))
+
+(defun trybot-fetch (type-hint url)
+ "Fetch a URL and postprocess it as trybot output."
+
+ (let ((on-fetch-completion
+ (lambda (process state)
+ (switch-to-buffer (process-buffer process))
+ (when (equal state "finished\n")
+ (trybot-fixup (process-get process 'type-hint)))))
+ (command (concat "curl -s " url
+ (when (eq type-hint 'mac)
+ ; Pipe it through the output shortener.
+ (concat " | " (get-chrome-root)
+ "build/sanitize-mac-build-log.sed")))))
+
+ ; Start up the subprocess.
+ (let* ((coding-system-for-read 'utf-8-dos)
+ (buffer (trybot-get-new-buffer))
+ (process (start-process-shell-command "curl" buffer command)))
+ ; Attach the type hint to the process so we can get it back when
+ ; the process completes.
+ (process-put process 'type-hint type-hint)
+ (set-process-query-on-exit-flag process nil)
+ (set-process-sentinel process on-fetch-completion))))
+
(defun trybot-test (type-hint filename)
"Load the given test data filename and do the trybot parse on it."
- (switch-to-buffer (get-buffer-create "*trybot-test*"))
- (let ((inhibit-read-only t)
- (coding-system-for-read 'utf-8-dos))
- (erase-buffer)
- (insert-file-contents
- (concat (get-chrome-root) "tools/emacs/" filename))
-
- (trybot-fixup type-hint)))
+ (let ((trybot-buffer-name "*trybot-test*")
+ (url (concat "file://" (get-chrome-root) "tools/emacs/" filename)))
+ (trybot-fetch type-hint url)))
(defun trybot-test-win ()
"Load the Windows test data and do the trybot parse on it."
@@ -122,18 +151,11 @@
;; TODO: fixup URL to append /text if necessary.
- ;; Extract the body out of the URL.
- ; TODO: delete HTTP headers somehow.
- (let ((inhibit-read-only t)
- (coding-system-for-read 'utf-8-dos)
- (type-hint (cond ((string-match "/win/" url) 'win)
+ (let ((type-hint (cond ((string-match "/win/" url) 'win)
((string-match "/mac/" url) 'mac)
; Match /linux, /linux_view, etc.
((string-match "/linux" url) 'linux)
(t 'unknown))))
- (switch-to-buffer (get-buffer-create "*trybot*"))
- (buffer-swap-text (url-retrieve-synchronously url))
-
- (trybot-fixup type-hint)))
+ (trybot-fetch type-hint url)))
(provide 'trybot)