diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-02-19 19:44:50 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-02-20 00:19:11 +0200 |
commit | b2007217e0163fb42ef0e4452d44ae3392bccf55 (patch) | |
tree | 6be30c5284a117afcc61e1bbb130e5f01dbb7e28 /run_unittests.py | |
parent | 657d9f2b29334556366eb3c0801612e9e7385f57 (diff) | |
download | meson-b2007217e0163fb42ef0e4452d44ae3392bccf55.zip meson-b2007217e0163fb42ef0e4452d44ae3392bccf55.tar.gz meson-b2007217e0163fb42ef0e4452d44ae3392bccf55.tar.bz2 |
vala: Fix path of C file with generated Vala files
We missed one particular edge-case in #2413: when the generated vala
file is inside --basedir, the path is not just the basename.c
Since this case can never happen in a project test, this includes a unit
test for the same.
Closes https://github.com/mesonbuild/meson/issues/815
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/run_unittests.py b/run_unittests.py index 69f467b..3a66211 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -464,10 +464,8 @@ class BasePlatformTests(unittest.TestCase): self.builddirs = [] self.new_builddir() - def new_builddir(self): - # In case the directory is inside a symlinked directory, find the real - # path otherwise we might not find the srcdir from inside the builddir. - self.builddir = os.path.realpath(tempfile.mkdtemp()) + def change_builddir(self, newdir): + self.builddir = newdir self.privatedir = os.path.join(self.builddir, 'meson-private') self.logdir = os.path.join(self.builddir, 'meson-logs') self.installdir = os.path.join(self.builddir, 'install') @@ -475,6 +473,12 @@ class BasePlatformTests(unittest.TestCase): self.mtest_command = meson_command + ['test', '-C', self.builddir] self.builddirs.append(self.builddir) + def new_builddir(self): + # In case the directory is inside a symlinked directory, find the real + # path otherwise we might not find the srcdir from inside the builddir. + newdir = os.path.realpath(tempfile.mkdtemp()) + self.change_builddir(newdir) + def _print_meson_log(self): log = os.path.join(self.logdir, 'meson-log.txt') if not os.path.isfile(log): @@ -2578,6 +2582,22 @@ endian = 'little' self.init(testdir, ['--cross-file=' + name], inprocess=True) self.wipe() + def test_vala_generated_source_buildir_inside_source_tree(self): + ''' + Test that valac outputs generated C files in the expected location when + the builddir is a subdir of the source tree. + ''' + testdir = os.path.join(self.vala_test_dir, '8 generated sources') + newdir = os.path.join(self.builddir, 'srctree') + shutil.copytree(testdir, newdir) + testdir = newdir + # New builddir + builddir = os.path.join(testdir, 'subdir/_build') + os.makedirs(builddir, exist_ok=True) + self.change_builddir(builddir) + self.init(testdir) + self.build() + class LinuxArmCrossCompileTests(BasePlatformTests): ''' |