diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-03 18:57:57 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-02-06 19:10:03 +0100 |
commit | 97911c4384238b1f77220b62e245d33f51f7b17a (patch) | |
tree | f7ed87ab83cedea60f05435809844a062f204ed5 /run_unittests.py | |
parent | 14e0529a037eb8f3d809822c811d2c034d8f0788 (diff) | |
download | meson-97911c4384238b1f77220b62e245d33f51f7b17a.zip meson-97911c4384238b1f77220b62e245d33f51f7b17a.tar.gz meson-97911c4384238b1f77220b62e245d33f51f7b17a.tar.bz2 |
Fix absolute prefix/xxxdir subdir check on Windows
os.path.commonpath (and our implementation of it) both always return the
path using the native operating system path separator, so we can't just
directly compare it since the prefix could be specified in '/', and
commonpath would use '\' on Windows.
Also add a unit test for this.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py index e8659f4..aed1412 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -15,10 +15,11 @@ import stat import shlex -import unittest, os, sys, shutil, time import subprocess import re, json import tempfile +import pathlib +import unittest, os, sys, shutil, time from glob import glob import mesonbuild.compilers import mesonbuild.environment @@ -169,6 +170,9 @@ class InternalTests(unittest.TestCase): self.assertEqual(commonpath(['/usr', '/bin']), sep) self.assertEqual(commonpath(['/usr', 'bin']), '') self.assertEqual(commonpath(['blam', 'bin']), '') + prefix = '/some/path/to/prefix' + libdir = '/some/path/to/prefix/libdir' + self.assertEqual(commonpath([prefix, libdir]), str(pathlib.PurePath(prefix))) class LinuxlikeTests(unittest.TestCase): |