From f6c9e8e29bb82a31dedc9cff46b76935612a80e8 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 26 Feb 2025 11:33:05 +0800 Subject: [PATCH] Adapt a number of regression tests to Android * test/infra/android/test-controller.el (ats-run-test): Strip text properties from value string. Inhibit text conversion. * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--locate-symbols): * test/lisp/emacs-lisp/rmc-tests.el (test-rmc--add-key-description) (test-rmc--add-key-description/with-attributes) (test-rmc--add-key-description/non-graphical-display) (test-read-multiple-choice, test-read-multiple-choice-help): Skip on Android in some wise or another. (cherry picked from commit 2938afab3685f29c80d67f179ce8a935f6c27921) --- test/infra/android/test-controller.el | 4 +++- test/lisp/emacs-lisp/find-func-tests.el | 2 ++ test/lisp/emacs-lisp/rmc-tests.el | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/infra/android/test-controller.el b/test/infra/android/test-controller.el index be4fc4586d7..89b9b93f7b1 100644 --- a/test/infra/android/test-controller.el +++ b/test/infra/android/test-controller.el @@ -2436,6 +2436,7 @@ Display the output of the tests executed in a buffer." ;; present... (ert-remote-temporary-file-directory null-device) + (overriding-text-conversion-style nil) (set-message-function (lambda (message) (with-current-buffer temp-buffer @@ -2443,7 +2444,8 @@ Display the output of the tests executed in a buffer." (let ((noninteractive t)) (ert-run-tests-batch ',selector)) (insert "=== Test execution complete ===\n") - (buffer-string)))))) + (buffer-substring-no-properties + (point-min) (point-max))))))) (cond ((eq (car rc) 'error) (error "Error executing `%s-tests.el': %S" test (cdr rc))) (t (progn diff --git a/test/lisp/emacs-lisp/find-func-tests.el b/test/lisp/emacs-lisp/find-func-tests.el index 47190873ec3..884e698bc76 100644 --- a/test/lisp/emacs-lisp/find-func-tests.el +++ b/test/lisp/emacs-lisp/find-func-tests.el @@ -30,6 +30,8 @@ (require 'find-func) (ert-deftest find-func-tests--locate-symbols () + ;; C source files are unavailable when testing on Android. + (skip-when (featurep 'android)) (should (cdr (find-function-search-for-symbol #'goto-line nil "simple"))) diff --git a/test/lisp/emacs-lisp/rmc-tests.el b/test/lisp/emacs-lisp/rmc-tests.el index d91704423c8..de705691ced 100644 --- a/test/lisp/emacs-lisp/rmc-tests.el +++ b/test/lisp/emacs-lisp/rmc-tests.el @@ -30,6 +30,7 @@ (eval-when-compile (require 'cl-lib)) (ert-deftest test-rmc--add-key-description () + (skip-when (display-graphic-p)) (cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ _) t))) (should (equal (rmc--add-key-description '(?y "yes")) '(?y . "yes"))) @@ -50,6 +51,7 @@ `(?\s . ,(concat (propertize "SPC" 'face 'read-multiple-choice) " foo bar"))))) (ert-deftest test-read-multiple-choice () + (skip-when (display-graphic-p)) (dolist (char '(?y ?n)) (cl-letf* (((symbol-function #'read-key) (lambda () char)) (str (if (eq char ?y) "yes" "no"))) -- 2.39.5