Delete temp directory after bytecomp test
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--not-writable-directory): Allow deletion of directory (bug#51690). * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--dest-mountpoint): Ditto.
This commit is contained in:
parent
35f9e0f469
commit
97fa2ffdf7
1 changed files with 37 additions and 29 deletions
|
@ -1246,15 +1246,19 @@ writable (Bug#44631)."
|
||||||
(byte-compile-dest-file-function
|
(byte-compile-dest-file-function
|
||||||
(lambda (_) output-file))
|
(lambda (_) output-file))
|
||||||
(byte-compile-error-on-warn t))
|
(byte-compile-error-on-warn t))
|
||||||
(write-region "" nil input-file nil nil nil 'excl)
|
(unwind-protect
|
||||||
(write-region "" nil output-file nil nil nil 'excl)
|
(progn
|
||||||
(set-file-modes input-file #o400)
|
(write-region "" nil input-file nil nil nil 'excl)
|
||||||
(set-file-modes output-file #o200)
|
(write-region "" nil output-file nil nil nil 'excl)
|
||||||
(set-file-modes directory #o500)
|
(set-file-modes input-file #o400)
|
||||||
(should (byte-compile-file input-file))
|
(set-file-modes output-file #o200)
|
||||||
(should (file-regular-p output-file))
|
(set-file-modes directory #o500)
|
||||||
(should (cl-plusp (file-attribute-size
|
(should (byte-compile-file input-file))
|
||||||
(file-attributes output-file)))))))
|
(should (file-regular-p output-file))
|
||||||
|
(should (cl-plusp (file-attribute-size
|
||||||
|
(file-attributes output-file)))))
|
||||||
|
;; Allow the directory to be deleted.
|
||||||
|
(set-file-modes directory #o777)))))
|
||||||
|
|
||||||
(ert-deftest bytecomp-tests--dest-mountpoint ()
|
(ert-deftest bytecomp-tests--dest-mountpoint ()
|
||||||
"Test that byte compilation works if the destination file is a
|
"Test that byte compilation works if the destination file is a
|
||||||
|
@ -1277,26 +1281,30 @@ mountpoint (Bug#44631)."
|
||||||
(should-not (file-remote-p output-file))
|
(should-not (file-remote-p output-file))
|
||||||
(write-region "" nil input-file nil nil nil 'excl)
|
(write-region "" nil input-file nil nil nil 'excl)
|
||||||
(write-region "" nil output-file nil nil nil 'excl)
|
(write-region "" nil output-file nil nil nil 'excl)
|
||||||
(set-file-modes input-file #o400)
|
(unwind-protect
|
||||||
(set-file-modes output-file #o200)
|
(progn
|
||||||
(set-file-modes directory #o500)
|
(set-file-modes input-file #o400)
|
||||||
(with-temp-buffer
|
(set-file-modes output-file #o200)
|
||||||
(let ((status (call-process
|
(set-file-modes directory #o500)
|
||||||
bwrap nil t nil
|
(with-temp-buffer
|
||||||
"--ro-bind" "/" "/"
|
(let ((status (call-process
|
||||||
"--bind" unquoted-file unquoted-file
|
bwrap nil t nil
|
||||||
emacs "--quick" "--batch" "--load=bytecomp"
|
"--ro-bind" "/" "/"
|
||||||
(format "--eval=%S"
|
"--bind" unquoted-file unquoted-file
|
||||||
`(setq byte-compile-dest-file-function
|
emacs "--quick" "--batch" "--load=bytecomp"
|
||||||
(lambda (_) ,output-file)
|
(format "--eval=%S"
|
||||||
byte-compile-error-on-warn t))
|
`(setq byte-compile-dest-file-function
|
||||||
"--funcall=batch-byte-compile" input-file)))
|
(lambda (_) ,output-file)
|
||||||
(unless (eql status 0)
|
byte-compile-error-on-warn t))
|
||||||
(ert-fail `((status . ,status)
|
"--funcall=batch-byte-compile" input-file)))
|
||||||
(output . ,(buffer-string)))))))
|
(unless (eql status 0)
|
||||||
(should (file-regular-p output-file))
|
(ert-fail `((status . ,status)
|
||||||
(should (cl-plusp (file-attribute-size
|
(output . ,(buffer-string)))))))
|
||||||
(file-attributes output-file))))))))
|
(should (file-regular-p output-file))
|
||||||
|
(should (cl-plusp (file-attribute-size
|
||||||
|
(file-attributes output-file)))))
|
||||||
|
;; Allow the directory to be deleted.
|
||||||
|
(set-file-modes directory #o777))))))
|
||||||
|
|
||||||
(ert-deftest bytecomp-tests--target-file-no-directory ()
|
(ert-deftest bytecomp-tests--target-file-no-directory ()
|
||||||
"Check that Bug#45287 is fixed."
|
"Check that Bug#45287 is fixed."
|
||||||
|
|
Loading…
Add table
Reference in a new issue