file-check-access.lisp 1.1 KB

123456789101112131415161718192021222324252627
  1. (in-package :translator-test)
  2. (def-test-method file-check-access-test ((test fs-test))
  3. (let ((file (concatenate-string +translator-root+
  4. "/root/a")))
  5. (with-testport (p (file-name-lookup file))
  6. (let ((stat (io-stat p)))
  7. (let ((mode (stat-get stat 'st-mode)))
  8. (with-cleanup (file-chmod p (stat-get stat 'st-mode))
  9. (set-perms mode :write)
  10. (assert-equal '(:write :read)
  11. (file-check-access p))))
  12. (let ((mode (stat-get stat 'st-mode)))
  13. (with-cleanup (file-chmod p (stat-get stat 'st-mode))
  14. (set-perms mode :exec)
  15. (file-chmod p mode)
  16. (assert-equal '(:exec :write :read)
  17. (file-check-access p))))
  18. (let ((mode (stat-get stat 'st-mode)))
  19. (with-cleanup (file-chmod p (stat-get stat 'st-mode))
  20. (set-perms mode :exec)
  21. (set-perms mode :write)
  22. (file-chmod p mode)
  23. (assert-equal '(:exec :write :read)
  24. (file-check-access p))))))))