#!/usr/bin/env python3 # Copyright 2016 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 unittest, os, shutil import subprocess class LinuxlikeTests(unittest.TestCase): def setUp(self): super().setUp() src_root = os.path.split(__file__)[0] self.meson_command = [os.path.join(src_root, 'meson.py')] self.ninja_command = ['ninja'] self.common_test_dir = os.path.join(src_root, 'test cases/common') self.builddir = 'unittestdir' # fixme to be unique os.mkdir(self.builddir) def tearDown(self): shutil.rmtree(self.builddir) super().tearDown() def test_simple(self): testdir = os.path.join(self.common_test_dir, '1 trivial') subprocess.check_call(self.meson_command + [testdir, self.builddir]) subprocess.check_call(self.ninja_command, cwd=self.builddir) if __name__ == '__main__': unittest.main()