From a024d75e150334330954bf7a6fdbe8cb02a82491 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 1 Sep 2022 00:59:41 -0400 Subject: backends: add a new "none" backend It can only be used for projects that don't have any rules at all, i.e. they are purely using Meson to: - configure files - run (script?) tests - install files that exist by the end of the setup stage This can be useful e.g. for Meson itself, a pure python project. --- unittests/baseplatformtests.py | 1 + unittests/platformagnostictests.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'unittests') diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py index d83ef3f..9e55f6e 100644 --- a/unittests/baseplatformtests.py +++ b/unittests/baseplatformtests.py @@ -70,6 +70,7 @@ class BasePlatformTests(TestCase): self.uninstall_command = get_backend_commands(self.backend) # Test directories self.common_test_dir = os.path.join(src_root, 'test cases/common') + self.python_test_dir = os.path.join(src_root, 'test cases/python') self.rust_test_dir = os.path.join(src_root, 'test cases/rust') self.vala_test_dir = os.path.join(src_root, 'test cases/vala') self.framework_test_dir = os.path.join(src_root, 'test cases/frameworks') diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index 39965c6..fce115d 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json import os import tempfile import subprocess @@ -121,3 +122,19 @@ class PlatformAgnosticTests(BasePlatformTests): ''')) subprocess.check_call(self.wrap_command + ['update-db'], cwd=testdir) self.init(testdir, workdir=testdir) + + def test_none_backend(self): + testdir = os.path.join(self.python_test_dir, '7 install path') + + self.init(testdir, extra_args=['--backend=none'], override_envvars={'NINJA': 'absolutely false command'}) + self.assertPathDoesNotExist(os.path.join(self.builddir, 'build.ninja')) + + self.run_tests(inprocess=True, override_envvars={}) + + out = self._run(self.meson_command + ['install', f'--destdir={self.installdir}'], workdir=self.builddir) + self.assertNotIn('Only ninja backend is supported to rebuild the project before installation.', out) + + with open(os.path.join(testdir, 'test.json'), 'rb') as f: + dat = json.load(f) + for i in dat['installed']: + self.assertPathExists(os.path.join(self.installdir, i['file'])) -- cgit v1.1