Don't use symbolic links in the test resource directory.

This doesn't work on Windows.  Instead, use the EMACS_TEST_DIRECTORY
environment variable to find the BPF files.

* test/src/emacs-tests.el (emacs-tests--lib-src): New constant.
(emacs-tests/seccomp/allows-stdout)
(emacs-tests/seccomp/forbids-subprocess)
(emacs-tests/bwrap/allows-stdout): Use it.
This commit is contained in:
Philipp Stephani 2021-05-07 18:36:57 +02:00
parent 9457d4f20f
commit a2842a1172
3 changed files with 10 additions and 6 deletions

View file

@ -1 +0,0 @@
../../../lib-src/seccomp-filter-exec.bpf

View file

@ -1 +0,0 @@
../../../lib-src/seccomp-filter.bpf

View file

@ -25,10 +25,13 @@
(require 'cl-lib)
(require 'ert)
(require 'ert-x)
(require 'rx)
(require 'subr-x)
(defconst emacs-tests--lib-src
(substitute-in-file-name "$EMACS_TEST_DIRECTORY/../lib-src/")
"Location of the lib-src directory.")
(ert-deftest emacs-tests/seccomp/absent-file ()
(skip-unless (string-match-p (rx bow "SECCOMP" eow)
system-configuration-features))
@ -135,7 +138,8 @@ to `make-temp-file', which see."
system-configuration-features))
(let ((emacs
(expand-file-name invocation-name invocation-directory))
(filter (ert-resource-file "seccomp-filter.bpf"))
(filter (expand-file-name "seccomp-filter.bpf"
emacs-tests--lib-src))
(process-environment nil))
(skip-unless (file-executable-p emacs))
(skip-unless (file-readable-p filter))
@ -160,7 +164,8 @@ to `make-temp-file', which see."
system-configuration-features))
(let ((emacs
(expand-file-name invocation-name invocation-directory))
(filter (ert-resource-file "seccomp-filter.bpf"))
(filter (expand-file-name "seccomp-filter.bpf"
emacs-tests--lib-src))
(process-environment nil))
(skip-unless (file-executable-p emacs))
(skip-unless (file-readable-p filter))
@ -186,7 +191,8 @@ to `make-temp-file', which see."
(bwrap (executable-find "bwrap"))
(emacs
(expand-file-name invocation-name invocation-directory))
(filter (ert-resource-file "seccomp-filter-exec.bpf"))
(filter (expand-file-name "seccomp-filter-exec.bpf"
emacs-tests--lib-src))
(process-environment nil))
(skip-unless bash)
(skip-unless bwrap)