]> git.eshelyaron.com Git - emacs.git/commitdiff
; New `bisect' argument to `ats-execute-tests-batch'
authorPo Lu <luangruo@yahoo.com>
Sun, 16 Mar 2025 12:14:32 +0000 (20:14 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 16 Mar 2025 16:37:29 +0000 (17:37 +0100)
* test/infra/android/test-controller.el
(ats-execute-tests-batch): New argument `bisect'.

(cherry picked from commit 5d02ca181daa2b3833a2b32157388a7b131955e8)

test/infra/android/test-controller.el

index 63fa54336a74c00be97fa19fb1b3f5f1ea5d1bbb..648185e927c52261c9d23029248f6b084924e75a 100644 (file)
@@ -2533,7 +2533,13 @@ The following command-line arguments are also accepted:
   --stub-file          Name of `stub.zip' wrapper required on Android <= 4.4.
   --test-dir           Directory in which Emacs's tests are situated.
   --output-dir, -o DIR Name of a directory into which to save test logs.
-  --no-upload          Don't upload tests; only run those which already exist."
+  --no-upload          Don't upload tests; only run those which already exist.
+
+In addition, these options exist to facilitate debugging the
+automated testing process itself.
+
+  --bisect COUNT       Skip COUNT tests from the beginning to investigate
+                       compatibility issues between tests."
   (let* ((ats-adb-host (getenv "ATS_ADB_HOST"))
         (devices (ats-enumerate-devices
                   (lambda (name state _)
@@ -2543,7 +2549,8 @@ The following command-line arguments are also accepted:
         (cmd-device nil)
         (cmd-user nil)
         (cmd-output-dir nil)
-        (cmd-no-upload nil))
+        (cmd-no-upload nil)
+        (bisect 0))
     ;; Read command-line arguments.
     (let (arg)
       (while (setq arg (pop argv))
@@ -2564,7 +2571,13 @@ The following command-line arguments are also accepted:
   --stub-file          Name of `stub.zip' wrapper required on Android <= 4.4.
   --test-dir           Directory in which Emacs's tests are situated.
   --output-dir, -o DIR Name of a directory into which to save test logs.
-  --no-upload          Don't upload tests; only run those which already exist.")
+  --no-upload          Don't upload tests; only run those which already exist.
+
+In addition, these options exist to facilitate debugging the
+automated testing process itself.
+
+  --bisect COUNT       Skip COUNT tests from the beginning to investigate
+                       compatibility issues between tests.")
               (kill-emacs 0))
              ((or (equal arg "-s") (equal arg "--device"))
               (setq cmd-device
@@ -2593,6 +2606,17 @@ The following command-line arguments are also accepted:
                          "Expected argument to `--test-dir' option."))))
              ((equal arg "--no-upload")
               (setq cmd-no-upload t))
+             ((equal arg "--bisect")
+              (let ((value (or (pop argv)
+                               (ats-cmd-error
+                                "Expected argument to `--bisect' option."))))
+                (setq bisect (progn
+                               (unless (string-match-p
+                                        "\\`[[:digit:]]+\\'" value)
+                                 (ats-cmd-error
+                                  "Invalid value for `--bisect' option: `%s'"
+                                  value))
+                               (string-to-number value)))))
              (t (ats-cmd-error "Unknown command line argument `%s'" arg)))))
     ;; Validate and apply command-line arguments or prompt the user for
     ;; parameters in their absence.
@@ -2621,10 +2645,11 @@ The following command-line arguments are also accepted:
           (user nil))
       (if cmd-user
          (progn
-           (let ((valid-number (string-match-p "^[[:digit:]]+$" cmd-user))
+           (let ((valid-number
+                  (string-match-p "\\`[[:digit:]]+\\'" cmd-user))
                  (uid (string-to-number cmd-user)))
              (unless valid-number
-               (ats-cmd-error "Invalid value for `--user' argument: %s"
+               (ats-cmd-error "Invalid value for `--user' argument: `'%s'"
                            cmd-user))
              (unless (assq uid users)
                (ats-cmd-error "No such user exists: %d" uid))
@@ -2651,8 +2676,9 @@ The following command-line arguments are also accepted:
                   (read-directory-name
                    "Where to save test log files? "))))
          (mkdir output-directory t)
-         (let ((tests (ats-list-tests connection)))
-           (dolist (test tests)
+         (let* ((tests (ats-list-tests connection))
+                (start (nthcdr bisect tests)))
+           (dolist (test start)
              (message "Generating `%s/%s-test.log'"
                       output-directory test)
              (ats-run-test connection test)