aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-09-01 00:59:41 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-03-20 17:22:50 -0400
commita024d75e150334330954bf7a6fdbe8cb02a82491 (patch)
tree0504f3471f335d79d994d9f68028233f95f38bb5 /unittests
parent2a0b80eb679f27402035faa93b3b6b16f5839724 (diff)
downloadmeson-a024d75e150334330954bf7a6fdbe8cb02a82491.zip
meson-a024d75e150334330954bf7a6fdbe8cb02a82491.tar.gz
meson-a024d75e150334330954bf7a6fdbe8cb02a82491.tar.bz2
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.
Diffstat (limited to 'unittests')
-rw-r--r--unittests/baseplatformtests.py1
-rw-r--r--unittests/platformagnostictests.py17
2 files changed, 18 insertions, 0 deletions
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']))