diff options
-rwxr-xr-x | run_unittests.py | 3 | ||||
-rwxr-xr-x | test cases/unit/99 relative find program/foo.py | 3 | ||||
-rw-r--r-- | test cases/unit/99 relative find program/meson.build | 3 | ||||
-rw-r--r-- | test cases/unit/99 relative find program/subdir/meson.build | 2 | ||||
-rw-r--r-- | unittests/platformagnostictests.py | 34 |
5 files changed, 44 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py index 2421e8d..f438daa 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -54,6 +54,7 @@ from unittests.linuxliketests import LinuxlikeTests from unittests.pythontests import PythonTests from unittests.subprojectscommandtests import SubprojectsCommandTests from unittests.windowstests import WindowsTests +from unittests.platformagnostictests import PlatformAgnosticTests def unset_envs(): # For unit tests we must fully control all command lines @@ -120,7 +121,7 @@ def main(): setup_backend() cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests', 'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests', - 'TAPParserTests', 'SubprojectsCommandTests', + 'TAPParserTests', 'SubprojectsCommandTests', 'PlatformAgnosticTests', 'LinuxlikeTests', 'LinuxCrossArmTests', 'LinuxCrossMingwTests', 'WindowsTests', 'DarwinTests'] diff --git a/test cases/unit/99 relative find program/foo.py b/test cases/unit/99 relative find program/foo.py new file mode 100755 index 0000000..21239b7 --- /dev/null +++ b/test cases/unit/99 relative find program/foo.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +exit(0)
\ No newline at end of file diff --git a/test cases/unit/99 relative find program/meson.build b/test cases/unit/99 relative find program/meson.build new file mode 100644 index 0000000..5745d8a --- /dev/null +++ b/test cases/unit/99 relative find program/meson.build @@ -0,0 +1,3 @@ +project('relative find program') + +subdir('subdir')
\ No newline at end of file diff --git a/test cases/unit/99 relative find program/subdir/meson.build b/test cases/unit/99 relative find program/subdir/meson.build new file mode 100644 index 0000000..475f5f5 --- /dev/null +++ b/test cases/unit/99 relative find program/subdir/meson.build @@ -0,0 +1,2 @@ +prog = find_program('./foo.py', required: false) +assert(not prog.found())
\ No newline at end of file diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py new file mode 100644 index 0000000..b26404d --- /dev/null +++ b/unittests/platformagnostictests.py @@ -0,0 +1,34 @@ +# Copyright 2021 The Meson development team + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from unittest import skipIf + +from .baseplatformtests import BasePlatformTests +from .helpers import is_ci +from mesonbuild.mesonlib import is_linux + +@skipIf(is_ci() and not is_linux(), "Run only on fast platforms") +class PlatformAgnosticTests(BasePlatformTests): + ''' + Tests that does not need to run on all platforms during CI + ''' + + def test_relative_find_program(self): + ''' + Tests that find_program() with a relative path does not find the program + in current workdir. + ''' + testdir = os.path.join(self.unit_test_dir, '99 relative find program') + self.init(testdir, workdir=testdir) |