diff options
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 5aadd670f56..dbc0aa3db42 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -1246,15 +1246,19 @@ writable (Bug#44631)." | |||
| 1246 | (byte-compile-dest-file-function | 1246 | (byte-compile-dest-file-function |
| 1247 | (lambda (_) output-file)) | 1247 | (lambda (_) output-file)) |
| 1248 | (byte-compile-error-on-warn t)) | 1248 | (byte-compile-error-on-warn t)) |
| 1249 | (write-region "" nil input-file nil nil nil 'excl) | 1249 | (unwind-protect |
| 1250 | (write-region "" nil output-file nil nil nil 'excl) | 1250 | (progn |
| 1251 | (set-file-modes input-file #o400) | 1251 | (write-region "" nil input-file nil nil nil 'excl) |
| 1252 | (set-file-modes output-file #o200) | 1252 | (write-region "" nil output-file nil nil nil 'excl) |
| 1253 | (set-file-modes directory #o500) | 1253 | (set-file-modes input-file #o400) |
| 1254 | (should (byte-compile-file input-file)) | 1254 | (set-file-modes output-file #o200) |
| 1255 | (should (file-regular-p output-file)) | 1255 | (set-file-modes directory #o500) |
| 1256 | (should (cl-plusp (file-attribute-size | 1256 | (should (byte-compile-file input-file)) |
| 1257 | (file-attributes output-file))))))) | 1257 | (should (file-regular-p output-file)) |
| 1258 | (should (cl-plusp (file-attribute-size | ||
| 1259 | (file-attributes output-file))))) | ||
| 1260 | ;; Allow the directory to be deleted. | ||
| 1261 | (set-file-modes directory #o777))))) | ||
| 1258 | 1262 | ||
| 1259 | (ert-deftest bytecomp-tests--dest-mountpoint () | 1263 | (ert-deftest bytecomp-tests--dest-mountpoint () |
| 1260 | "Test that byte compilation works if the destination file is a | 1264 | "Test that byte compilation works if the destination file is a |
| @@ -1277,26 +1281,30 @@ mountpoint (Bug#44631)." | |||
| 1277 | (should-not (file-remote-p output-file)) | 1281 | (should-not (file-remote-p output-file)) |
| 1278 | (write-region "" nil input-file nil nil nil 'excl) | 1282 | (write-region "" nil input-file nil nil nil 'excl) |
| 1279 | (write-region "" nil output-file nil nil nil 'excl) | 1283 | (write-region "" nil output-file nil nil nil 'excl) |
| 1280 | (set-file-modes input-file #o400) | 1284 | (unwind-protect |
| 1281 | (set-file-modes output-file #o200) | 1285 | (progn |
| 1282 | (set-file-modes directory #o500) | 1286 | (set-file-modes input-file #o400) |
| 1283 | (with-temp-buffer | 1287 | (set-file-modes output-file #o200) |
| 1284 | (let ((status (call-process | 1288 | (set-file-modes directory #o500) |
| 1285 | bwrap nil t nil | 1289 | (with-temp-buffer |
| 1286 | "--ro-bind" "/" "/" | 1290 | (let ((status (call-process |
| 1287 | "--bind" unquoted-file unquoted-file | 1291 | bwrap nil t nil |
| 1288 | emacs "--quick" "--batch" "--load=bytecomp" | 1292 | "--ro-bind" "/" "/" |
| 1289 | (format "--eval=%S" | 1293 | "--bind" unquoted-file unquoted-file |
| 1290 | `(setq byte-compile-dest-file-function | 1294 | emacs "--quick" "--batch" "--load=bytecomp" |
| 1291 | (lambda (_) ,output-file) | 1295 | (format "--eval=%S" |
| 1292 | byte-compile-error-on-warn t)) | 1296 | `(setq byte-compile-dest-file-function |
| 1293 | "--funcall=batch-byte-compile" input-file))) | 1297 | (lambda (_) ,output-file) |
| 1294 | (unless (eql status 0) | 1298 | byte-compile-error-on-warn t)) |
| 1295 | (ert-fail `((status . ,status) | 1299 | "--funcall=batch-byte-compile" input-file))) |
| 1296 | (output . ,(buffer-string))))))) | 1300 | (unless (eql status 0) |
| 1297 | (should (file-regular-p output-file)) | 1301 | (ert-fail `((status . ,status) |
| 1298 | (should (cl-plusp (file-attribute-size | 1302 | (output . ,(buffer-string))))))) |
| 1299 | (file-attributes output-file)))))))) | 1303 | (should (file-regular-p output-file)) |
| 1304 | (should (cl-plusp (file-attribute-size | ||
| 1305 | (file-attributes output-file))))) | ||
| 1306 | ;; Allow the directory to be deleted. | ||
| 1307 | (set-file-modes directory #o777)))))) | ||
| 1300 | 1308 | ||
| 1301 | (ert-deftest bytecomp-tests--target-file-no-directory () | 1309 | (ert-deftest bytecomp-tests--target-file-no-directory () |
| 1302 | "Check that Bug#45287 is fixed." | 1310 | "Check that Bug#45287 is fixed." |