aboutsummaryrefslogtreecommitdiff
path: root/munit.py
blob: f2651d8a23ab8dc6b95cd7719a5b2c8fb0da5934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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()