#!/bin/sh # Usage: this_script [recompile [JOBS]] # # Without “recompile” this script only removes # “lisp/net/tramp-archive.elc” to ensure that Emacs uses the # “tramp-archive” version of the current revision; you have to have # built Emacs yourself before running this script. # # With “recompile” the repository is cleaned, the build configured, # and then Emacs build, before the test is run. JOBS is bassed to the # “-j” switch of “make”, that is: it “specifies the number of jobs to # run simultaneously”. # Emacs executable to use emacs=src/emacs skip_commit () { exit 125; } # Can “git bisect” really be properly and reliably # interupted this way? interrupt_bisect () { exit 255; } mark_good () { exit 0; } mark_bad () { exit 1; } if [ "$1" = "recompile" ] then jobs=${2:+-j$2} { git clean -dxf \ && ./autogen.sh \ && ./configure --without-x --without-gnutls \ && make $jobs src } || interrupt_bisect else # Ensure that “tramp-archive” from the current revision is used. # The byte-compiled version is from the revision where the # bisection started and would be preferred by Emacs. rm -f lisp/net/tramp-archive.elc fi # Restore “build-aux/install-sh” to the version in the current HEAD. # Otherwise, “git bisect” would abort after the script has finished # (at least at some revisions) as the checkout of the next revision # would fail because of changes to this file. git checkout -- build-aux/install-sh # ################################################## # The actual Test. ################################################## "$emacs" -Q --batch --eval \ " (let ((ret 1)) (unwind-protect (progn (load \"tramp-archive\") (let ((file-name-handler-alist (list (cons (tramp-archive-autoload-file-name-regexp) #'tramp-archive-autoload-file-name-handler))) (tramp-archive-enabled nil)) (file-directory-p \"~/emacs/test/lisp/net/tramp-archive-resources/foo.iso/\") ;; No error during ‘file-directory-p’ (setq ret 0))) (kill-emacs ret))) " ret=$? case $ret in 0) mark_good ;; 1) mark_bad ;; 255) # For some revisions the ‘kill-emacs’ in the unwind-form does # not work as expected and Emacs instead exits with 255, or # maybe that is -1, (as it does on erros in batch mode). # Using ‘condition-case’ would proberly fix that (and make a # more robust test), but this is quicker and good enough. mark_bad ;; *) printf "Unexpected return code by Emacs: %i\n" $ret >&2 interrupt_bisect ;; esac