     (insert ?\n)
     (buffer-substring-no-properties (point-min) (point-max))))
 
+(defun elisp/ert/outside--tree-p (file dir)
+  "Return whether FILE is outside DIR.
+Unlike ‘file-in-directory-p’, this doesn’t resolve symbolic
+links."
+  (cl-check-type file string)
+  (cl-check-type dir string)
+  (null (locate-dominating-file file (lambda (d) (file-equal-p d dir)))))
+
+(defun elisp/ert/load--compiled (fullname file noerror)
+  "Load a compiled file corresponding to FULLNAME.
+FILE and NOERROR are as in ‘load-source-file-function’.  Return t
+if loading was successful."
+  (cl-check-type fullname string)
+  (cl-check-type file string)
+  (let* ((dir (file-name-directory fullname))
+         (name (file-name-nondirectory fullname))
+         (suffix (or (cl-find-if (lambda (s) (string-suffix-p s name))
+                                 (get-load-suffixes))
+                     (error "File %s has unknown suffix" file)))
+         (stem
+          (substring-no-properties name 0 (- (length name) (length suffix))))
+         (compiled (or (locate-file (concat stem ".elc") (list dir)
+                                    load-file-rep-suffixes)
+                       (error "No compiled version of %s found" file))))
+    (load compiled noerror nil :nosuffix :must-suffix)))
+
 (defun elisp/ert/load--instrument (fullname file)
   "Load and instrument the Emacs Lisp file FULLNAME.
 FILE is an abbreviated name as described in

                 (noerror nil)
                 (t (signal 'file-error (list "Cannot open load file" file)))))
            load-source-file-function)))
    (and coverage-enabled (member coverage-dir '(nil ""))
         (error "Coverage requested but COVERAGE_DIR not set"))
    (unless (and (natnump shard-count) (natnump shard-index)

         (print-level 8)
         (print-length 50)
         (edebug-initial-mode 'Go-nonstop)  ; ‘step’ doesn’t work in batch mode
         (source-dir (getenv "TEST_SRCDIR"))
         (temp-dir (getenv "TEST_TMPDIR"))
         (temporary-file-directory (concat "/:" temp-dir))
         (report-file (getenv "XML_OUTPUT_FILE"))
         (test-filter (getenv "TESTBRIDGE_TEST_ONLY"))
         (random-seed (or (getenv "TEST_RANDOM_SEED") ""))
