aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorHemmo Nieminen <hemmo.nieminen@kone.com>2022-06-17 00:00:00 +0300
committerEli Schwartz <eschwartz93@gmail.com>2022-06-17 14:18:05 -0400
commitb49b9f52b29896cce58a1e3dbeb1b6cf54420d45 (patch)
treebca9182a5c6a739af01805f2cb63d82b3c60b146 /test cases
parent9b2142800658e2a63def39f2cfb1ec4cb18795bd (diff)
downloadmeson-b49b9f52b29896cce58a1e3dbeb1b6cf54420d45.zip
meson-b49b9f52b29896cce58a1e3dbeb1b6cf54420d45.tar.gz
meson-b49b9f52b29896cce58a1e3dbeb1b6cf54420d45.tar.bz2
interpreter: fix a subproject check with symlinks
The check for whether or not a file is allowed to be accessed from a subproject fails if the subproject is accessed via a symlink. Use the absolute path of the subproject without resolving symlinks to fix the check. Extend unit test 106 to check for this in the future.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/unit/106 subproject symlink/cp.py6
-rw-r--r--test cases/unit/106 subproject symlink/meson.build11
-rw-r--r--test cases/unit/106 subproject symlink/symlinked_subproject/datadir/datafile1
-rw-r--r--test cases/unit/106 subproject symlink/symlinked_subproject/datadir/meson.build1
-rw-r--r--test cases/unit/106 subproject symlink/symlinked_subproject/meson.build9
5 files changed, 25 insertions, 3 deletions
diff --git a/test cases/unit/106 subproject symlink/cp.py b/test cases/unit/106 subproject symlink/cp.py
new file mode 100644
index 0000000..adb0547
--- /dev/null
+++ b/test cases/unit/106 subproject symlink/cp.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+from sys import argv
+from shutil import copy
+
+copy(argv[1], argv[2])
diff --git a/test cases/unit/106 subproject symlink/meson.build b/test cases/unit/106 subproject symlink/meson.build
index 51c78c7..6766c8e 100644
--- a/test cases/unit/106 subproject symlink/meson.build
+++ b/test cases/unit/106 subproject symlink/meson.build
@@ -1,8 +1,15 @@
project('foo', 'c')
-symlinked_subproject = subproject('symlinked_subproject')
+symlinked_subproject = subproject('symlinked_subproject').get_variable('dep')
executable('foo',
sources : 'main.c',
- dependencies : symlinked_subproject.get_variable('dep')
+ dependencies : symlinked_subproject
+)
+
+custom_target(
+ input : symlinked_subproject.get_variable('datadir') / 'datafile',
+ output : 'datafile_copy',
+ command : [find_program('cp.py'), '@INPUT@', '@OUTPUT@'],
+ build_always : true
)
diff --git a/test cases/unit/106 subproject symlink/symlinked_subproject/datadir/datafile b/test cases/unit/106 subproject symlink/symlinked_subproject/datadir/datafile
new file mode 100644
index 0000000..6a68294
--- /dev/null
+++ b/test cases/unit/106 subproject symlink/symlinked_subproject/datadir/datafile
@@ -0,0 +1 @@
+hello meson
diff --git a/test cases/unit/106 subproject symlink/symlinked_subproject/datadir/meson.build b/test cases/unit/106 subproject symlink/symlinked_subproject/datadir/meson.build
new file mode 100644
index 0000000..cbeb0a9
--- /dev/null
+++ b/test cases/unit/106 subproject symlink/symlinked_subproject/datadir/meson.build
@@ -0,0 +1 @@
+install_data('datafile')
diff --git a/test cases/unit/106 subproject symlink/symlinked_subproject/meson.build b/test cases/unit/106 subproject symlink/symlinked_subproject/meson.build
index 61440c7..3930465 100644
--- a/test cases/unit/106 subproject symlink/symlinked_subproject/meson.build
+++ b/test cases/unit/106 subproject symlink/symlinked_subproject/meson.build
@@ -1,3 +1,10 @@
project('symlinked_subproject', 'c', version : '1.0.0')
-dep = declare_dependency(sources : 'src.c')
+dep = declare_dependency(
+ sources : 'src.c',
+ variables : {
+ 'datadir': meson.current_source_dir() / 'datadir'
+ }
+)
+
+subdir('datadir')