]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't use symbolic links in the test resource directory.
authorPhilipp Stephani <phst@google.com>
Fri, 7 May 2021 16:36:57 +0000 (18:36 +0200)
committerPhilipp Stephani <phst@google.com>
Fri, 7 May 2021 16:36:57 +0000 (18:36 +0200)
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.

test/src/emacs-resources/seccomp-filter-exec.bpf [deleted symlink]
test/src/emacs-resources/seccomp-filter.bpf [deleted symlink]
test/src/emacs-tests.el

diff --git a/test/src/emacs-resources/seccomp-filter-exec.bpf b/test/src/emacs-resources/seccomp-filter-exec.bpf
deleted file mode 120000 (symlink)
index 5b0e997..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../lib-src/seccomp-filter-exec.bpf
\ No newline at end of file
diff --git a/test/src/emacs-resources/seccomp-filter.bpf b/test/src/emacs-resources/seccomp-filter.bpf
deleted file mode 120000 (symlink)
index b3d603d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../lib-src/seccomp-filter.bpf
\ No newline at end of file
index ee5586fbaf441809a489c02ad66dcfc1cd57467a..ac08e055b5549a76f67c41ab48211fea818ab202 100644 (file)
 
 (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)