diff options
| author | Po Lu | 2025-02-26 10:35:00 +0800 |
|---|---|---|
| committer | Po Lu | 2025-02-26 10:39:46 +0800 |
| commit | c2804f928097ddea4826b232e310417320bb5ce0 (patch) | |
| tree | 05cf0e97eafca092bf5b7efc4cdec5a10ff23751 | |
| parent | c5853892c58be8e1c543177967850dceb1f4bcbc (diff) | |
| download | emacs-c2804f928097ddea4826b232e310417320bb5ce0.tar.gz emacs-c2804f928097ddea4826b232e310417320bb5ce0.zip | |
; Improve Android testing facilities
* test/infra/android/test-controller.el (ats-eval): Don't block
other processes.
(ats-run-test): Bind ert-remote-temporary-file-directory to nil
and always print messages into the output buffer.
(ats-upload-all-tests): New function.
(ats-run-all-tests): New argument SELECTOR. Only execute
already uploaded tests.
| -rw-r--r-- | test/infra/android/test-controller.el | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/test/infra/android/test-controller.el b/test/infra/android/test-controller.el index 0df7725e574..be4fc4586d7 100644 --- a/test/infra/android/test-controller.el +++ b/test/infra/android/test-controller.el | |||
| @@ -1934,7 +1934,7 @@ manner." | |||
| 1934 | ;; (prog1 (accept-process-output process nil nil 1) | 1934 | ;; (prog1 (accept-process-output process nil nil 1) |
| 1935 | ;; (setq ats-eval-tm (+ (- (float-time) t1) | 1935 | ;; (setq ats-eval-tm (+ (- (float-time) t1) |
| 1936 | ;; ats-eval-tm)))) | 1936 | ;; ats-eval-tm)))) |
| 1937 | (when (accept-process-output process nil nil 1) | 1937 | (when (accept-process-output process) |
| 1938 | (when (not size) | 1938 | (when (not size) |
| 1939 | ;; First skip all output till the header is read. | 1939 | ;; First skip all output till the header is read. |
| 1940 | (save-excursion | 1940 | (save-excursion |
| @@ -2430,10 +2430,16 @@ Display the output of the tests executed in a buffer." | |||
| 2430 | (ert-delete-all-tests) | 2430 | (ert-delete-all-tests) |
| 2431 | (load ,file-name) | 2431 | (load ,file-name) |
| 2432 | (with-temp-buffer | 2432 | (with-temp-buffer |
| 2433 | (let ((standard-output (current-buffer)) | 2433 | (let* ((temp-buffer (current-buffer)) |
| 2434 | (set-message-function | 2434 | (standard-output temp-buffer) |
| 2435 | (lambda (message) | 2435 | ;; Disable remote tests for the |
| 2436 | (insert message "\n")))) | 2436 | ;; present... |
| 2437 | (ert-remote-temporary-file-directory | ||
| 2438 | null-device) | ||
| 2439 | (set-message-function | ||
| 2440 | (lambda (message) | ||
| 2441 | (with-current-buffer temp-buffer | ||
| 2442 | (insert message "\n"))))) | ||
| 2437 | (let ((noninteractive t)) | 2443 | (let ((noninteractive t)) |
| 2438 | (ert-run-tests-batch ',selector)) | 2444 | (ert-run-tests-batch ',selector)) |
| 2439 | (insert "=== Test execution complete ===\n") | 2445 | (insert "=== Test execution complete ===\n") |
| @@ -2445,11 +2451,9 @@ Display the output of the tests executed in a buffer." | |||
| 2445 | (insert (cdr rc)) | 2451 | (insert (cdr rc)) |
| 2446 | (pop-to-buffer (current-buffer)))))))) | 2452 | (pop-to-buffer (current-buffer)))))))) |
| 2447 | 2453 | ||
| 2448 | (defun ats-run-all-tests (process dir) | 2454 | (defun ats-upload-all-tests (process dir) |
| 2449 | "Run all Emacs tests defined in DIR on the device represented by PROCESS. | 2455 | "Upload every Emacs test in DIR to the device represented by PROCESS. |
| 2450 | Upload each and every test defined in DIR to the said device, | 2456 | Upload each and every test defined in DIR to the said device." |
| 2451 | and execute them in sequence. With a prefix argument, just run | ||
| 2452 | the tests without uploading them." | ||
| 2453 | (interactive | 2457 | (interactive |
| 2454 | (list (ats-read-connection "Connection: ") | 2458 | (list (ats-read-connection "Connection: ") |
| 2455 | (or ats-emacs-test-directory | 2459 | (or ats-emacs-test-directory |
| @@ -2459,10 +2463,18 @@ the tests without uploading them." | |||
| 2459 | (unless current-prefix-arg | 2463 | (unless current-prefix-arg |
| 2460 | (dolist-with-progress-reporter (test tests) | 2464 | (dolist-with-progress-reporter (test tests) |
| 2461 | "Uploading tests to device..." | 2465 | "Uploading tests to device..." |
| 2462 | (ats-upload-test process dir test))) | 2466 | (ats-upload-test process dir test))))) |
| 2467 | |||
| 2468 | (defun ats-run-all-tests (process &optional selector) | ||
| 2469 | "Run every Emacs test uploaded to the device represented by PROCESS. | ||
| 2470 | Execute every Emacs test that has been uploaded to PROCESS, | ||
| 2471 | subject to SELECTOR, as in `ert-run-tests'." | ||
| 2472 | (interactive (list (ats-read-connection "Connection: ") | ||
| 2473 | (and current-prefix-arg (read)))) | ||
| 2474 | (let ((tests (ats-list-tests process))) | ||
| 2463 | (dolist-with-progress-reporter (test tests) | 2475 | (dolist-with-progress-reporter (test tests) |
| 2464 | "Running tests..." | 2476 | "Running tests..." |
| 2465 | (ats-run-test process test)))) | 2477 | (ats-run-test process test selector)))) |
| 2466 | 2478 | ||
| 2467 | (provide 'test-controller) | 2479 | (provide 'test-controller) |
| 2468 | 2480 | ||