[Notes] [Git][BuildStream/buildstream][mac_fixes] 14 commits: fuse: Report the correct device number for devices



Title: GitLab

Phillip Smyth pushed to branch mac_fixes at BuildStream / buildstream

Commits:

18 changed files:

Changes:

  • buildstream/_frontend/app.py
    ... ... @@ -116,14 +116,6 @@ class App():
    116 116
             else:
    
    117 117
                 self.colors = False
    
    118 118
     
    
    119
    -        # Increase the soft limit for open file descriptors to the maximum.
    
    120
    -        # SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox.
    
    121
    -        # Avoid hitting the limit too quickly.
    
    122
    -        limits = resource.getrlimit(resource.RLIMIT_NOFILE)
    
    123
    -        if limits[0] != limits[1]:
    
    124
    -            # Set soft limit to hard limit
    
    125
    -            resource.setrlimit(resource.RLIMIT_NOFILE, (limits[1], limits[1]))
    
    126
    -
    
    127 119
         # create()
    
    128 120
         #
    
    129 121
         # Should be used instead of the regular constructor.
    

  • buildstream/_fuse/hardlinks.py
    ... ... @@ -42,9 +42,10 @@ from .mount import Mount
    42 42
     #
    
    43 43
     class SafeHardlinks(Mount):
    
    44 44
     
    
    45
    -    def __init__(self, directory, tempdir):
    
    45
    +    def __init__(self, directory, tempdir, fuse_mount_options={}):
    
    46 46
             self.directory = directory
    
    47 47
             self.tempdir = tempdir
    
    48
    +        super().__init__(fuse_mount_options=fuse_mount_options)
    
    48 49
     
    
    49 50
         def create_operations(self):
    
    50 51
             return SafeHardlinkOps(self.directory, self.tempdir)
    
    ... ... @@ -121,7 +122,7 @@ class SafeHardlinkOps(Operations):
    121 122
             st = os.lstat(full_path)
    
    122 123
             return dict((key, getattr(st, key)) for key in (
    
    123 124
                 'st_atime', 'st_ctime', 'st_gid', 'st_mode',
    
    124
    -            'st_mtime', 'st_nlink', 'st_size', 'st_uid'))
    
    125
    +            'st_mtime', 'st_nlink', 'st_size', 'st_uid', 'st_rdev'))
    
    125 126
     
    
    126 127
         def readdir(self, path, fh):
    
    127 128
             full_path = self._full_path(path)
    

  • buildstream/_fuse/mount.py
    ... ... @@ -87,6 +87,9 @@ class Mount():
    87 87
         #               User Facing API                #
    
    88 88
         ################################################
    
    89 89
     
    
    90
    +    def __init__(self, fuse_mount_options={}):
    
    91
    +        self._fuse_mount_options = fuse_mount_options
    
    92
    +
    
    90 93
         # mount():
    
    91 94
         #
    
    92 95
         # User facing API for mounting a fuse subclass implementation
    
    ... ... @@ -184,7 +187,8 @@ class Mount():
    184 187
             # Run fuse in foreground in this child process, internally libfuse
    
    185 188
             # will handle SIGTERM and gracefully exit it's own little main loop.
    
    186 189
             #
    
    187
    -        FUSE(self.__operations, self.__mountpoint, nothreads=True, foreground=True, nonempty=True)
    
    190
    +        FUSE(self.__operations, self.__mountpoint, nothreads=True, foreground=True, nonempty=True,
    
    191
    +             **self._fuse_mount_options)
    
    188 192
     
    
    189 193
             # Explicit 0 exit code, if the operations crashed for some reason, the exit
    
    190 194
             # code will not be 0, and we want to know about it.
    

  • buildstream/_platform/darwin.py
    1
    +#
    
    2
    +#  Copyright (C) 2017 Codethink Limited
    
    3
    +#  Copyright (C) 2018 Bloomberg Finance LP
    
    4
    +#
    
    5
    +#  This program is free software; you can redistribute it and/or
    
    6
    +#  modify it under the terms of the GNU Lesser General Public
    
    7
    +#  License as published by the Free Software Foundation; either
    
    8
    +#  version 2 of the License, or (at your option) any later version.
    
    9
    +#
    
    10
    +#  This library is distributed in the hope that it will be useful,
    
    11
    +#  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    12
    +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
    
    13
    +#  Lesser General Public License for more details.
    
    14
    +#
    
    15
    +#  You should have received a copy of the GNU Lesser General Public
    
    16
    +#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
    
    17
    +
    
    18
    +import os
    
    19
    +import resource
    
    20
    +
    
    21
    +from .._exceptions import PlatformError
    
    22
    +from ..sandbox import SandboxChroot, SandboxDummy
    
    23
    +
    
    24
    +from . import Platform
    
    25
    +
    
    26
    +
    
    27
    +class Darwin(Platform):
    
    28
    +
    
    29
    +    # This value comes from OPEN_MAX in syslimits.h
    
    30
    +    OPEN_MAX = 10240
    
    31
    +
    
    32
    +    def __init__(self, context):
    
    33
    +
    
    34
    +        super().__init__(context)
    
    35
    +
    
    36
    +    @property
    
    37
    +    def artifactcache(self):
    
    38
    +        return self._artifact_cache
    
    39
    +
    
    40
    +    def create_sandbox(self, *args, **kwargs):
    
    41
    +        return SandboxDummy(*args, **kwargs)
    
    42
    +
    
    43
    +    def get_cpu_count(self, cap=None):
    
    44
    +        if cap < os.cpu_count():
    
    45
    +            return cap
    
    46
    +        else:
    
    47
    +            return os.cpu_count()
    
    48
    +
    
    49
    +    def set_resource_limits(self, soft_limit=OPEN_MAX, hard_limit=None):
    
    50
    +        super().set_resource_limits(soft_limit)

  • buildstream/_platform/linux.py
    ... ... @@ -17,13 +17,14 @@
    17 17
     #  Authors:
    
    18 18
     #        Tristan Maat <tristan maat codethink co uk>
    
    19 19
     
    
    20
    +import os
    
    20 21
     import subprocess
    
    21 22
     
    
    22 23
     from .. import _site
    
    23 24
     from .. import utils
    
    24 25
     from .._artifactcache.cascache import CASCache
    
    25 26
     from .._message import Message, MessageType
    
    26
    -from ..sandbox import SandboxBwrap
    
    27
    +from ..sandbox import SandboxBwrap, SandboxDummy
    
    27 28
     
    
    28 29
     from . import Platform
    
    29 30
     
    
    ... ... @@ -32,27 +33,40 @@ class Linux(Platform):
    32 33
     
    
    33 34
         def __init__(self, context):
    
    34 35
     
    
    35
    -        super().__init__(context)
    
    36
    -
    
    37 36
             self._die_with_parent_available = _site.check_bwrap_version(0, 1, 8)
    
    38
    -        self._user_ns_available = self._check_user_ns_available(context)
    
    39
    -        self._artifact_cache = CASCache(context, enable_push=self._user_ns_available)
    
    37
    +
    
    38
    +        if self._local_sandbox_available():
    
    39
    +            self._user_ns_available = self._check_user_ns_available(context)
    
    40
    +        else:
    
    41
    +            self._user_ns_available = False
    
    42
    +
    
    43
    +        # _user_ns_available needs to be set before chaining up to the super class
    
    44
    +        # This is because it will call create_CAS_instance()
    
    45
    +        super().__init__(context)
    
    40 46
     
    
    41 47
         @property
    
    42 48
         def artifactcache(self):
    
    43 49
             return self._artifact_cache
    
    44 50
     
    
    45 51
         def create_sandbox(self, *args, **kwargs):
    
    46
    -        # Inform the bubblewrap sandbox as to whether it can use user namespaces or not
    
    47
    -        kwargs['user_ns_available'] = self._user_ns_available
    
    48
    -        kwargs['die_with_parent_available'] = self._die_with_parent_available
    
    49
    -        return SandboxBwrap(*args, **kwargs)
    
    52
    +        if not self._local_sandbox_available():
    
    53
    +            return SandboxDummy(*args, **kwargs)
    
    54
    +        else:
    
    55
    +            # Inform the bubblewrap sandbox as to whether it can use user namespaces or not
    
    56
    +            kwargs['user_ns_available'] = self._user_ns_available
    
    57
    +            kwargs['die_with_parent_available'] = self._die_with_parent_available
    
    58
    +            return SandboxBwrap(*args, **kwargs)
    
    59
    +
    
    60
    +    def create_artifact_cache(self, context, enable_push):
    
    61
    +        return super().create_artifact_cache(context, self._user_ns_available)
    
    50 62
     
    
    51 63
         ################################################
    
    52 64
         #              Private Methods                 #
    
    53 65
         ################################################
    
    54
    -    def _check_user_ns_available(self, context):
    
    66
    +    def _local_sandbox_available(self):
    
    67
    +        return os.path.exists(utils.get_host_tool('bwrap')) and os.path.exists('/dev/fuse')
    
    55 68
     
    
    69
    +    def _check_user_ns_available(self, context):
    
    56 70
             # Here, lets check if bwrap is able to create user namespaces,
    
    57 71
             # issue a warning if it's not available, and save the state
    
    58 72
             # locally so that we can inform the sandbox to not try it
    

  • buildstream/_platform/platform.py
    ... ... @@ -19,8 +19,10 @@
    19 19
     
    
    20 20
     import os
    
    21 21
     import sys
    
    22
    +import resource
    
    22 23
     
    
    23 24
     from .._exceptions import PlatformError, ImplError
    
    25
    +from .._artifactcache.cascache import CASCache
    
    24 26
     
    
    25 27
     
    
    26 28
     class Platform():
    
    ... ... @@ -37,22 +39,28 @@ class Platform():
    37 39
         #
    
    38 40
         def __init__(self, context):
    
    39 41
             self.context = context
    
    42
    +        self.set_resource_limits()
    
    43
    +        self._artifact_cache = self.create_CAS_instance(context, True)
    
    40 44
     
    
    41 45
         @classmethod
    
    42 46
         def create_instance(cls, *args, **kwargs):
    
    43
    -        if sys.platform.startswith('linux'):
    
    44
    -            backend = 'linux'
    
    45
    -        else:
    
    46
    -            backend = 'unix'
    
    47 47
     
    
    48 48
             # Meant for testing purposes and therefore hidden in the
    
    49 49
             # deepest corners of the source code. Try not to abuse this,
    
    50 50
             # please?
    
    51 51
             if os.getenv('BST_FORCE_BACKEND'):
    
    52 52
                 backend = os.getenv('BST_FORCE_BACKEND')
    
    53
    +        elif sys.platform.startswith('linux'):
    
    54
    +            backend = 'linux'
    
    55
    +        elif sys.platform.startswith('darwin'):
    
    56
    +            backend = 'darwin'
    
    57
    +        else:
    
    58
    +            backend = 'unix'
    
    53 59
     
    
    54 60
             if backend == 'linux':
    
    55 61
                 from .linux import Linux as PlatformImpl
    
    62
    +        elif backend == 'darwin':
    
    63
    +            from .darwin import Darwin as PlatformImpl
    
    56 64
             elif backend == 'unix':
    
    57 65
                 from .unix import Unix as PlatformImpl
    
    58 66
             else:
    
    ... ... @@ -66,6 +74,9 @@ class Platform():
    66 74
                 raise PlatformError("Platform needs to be initialized first")
    
    67 75
             return cls._instance
    
    68 76
     
    
    77
    +    def get_cpu_count(self, cap=None):
    
    78
    +        return min(len(os.sched_getaffinity(0)), cap)
    
    79
    +
    
    69 80
         ##################################################################
    
    70 81
         #                       Platform properties                      #
    
    71 82
         ##################################################################
    
    ... ... @@ -92,3 +103,18 @@ class Platform():
    92 103
         def create_sandbox(self, *args, **kwargs):
    
    93 104
             raise ImplError("Platform {platform} does not implement create_sandbox()"
    
    94 105
                             .format(platform=type(self).__name__))
    
    106
    +
    
    107
    +    def set_resource_limits(self, soft_limit=None, hard_limit=None):
    
    108
    +        # Need to set resources for _frontend/app.py as this is dependent on the platform
    
    109
    +        # SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox.
    
    110
    +        # Avoid hitting the limit too quickly.
    
    111
    +        limits = resource.getrlimit(resource.RLIMIT_NOFILE)
    
    112
    +        if limits[0] != limits[1]:
    
    113
    +            if soft_limit is None:
    
    114
    +                soft_limit = limits[1]
    
    115
    +            if hard_limit is None:
    
    116
    +                hard_limit = limits[1]
    
    117
    +            resource.setrlimit(resource.RLIMIT_NOFILE, (soft_limit, hard_limit))
    
    118
    +
    
    119
    +    def create_artifact_cache(self, context, enable_push=True):
    
    120
    +        return CASCache(context=context, enable_push=enable_push)

  • buildstream/_platform/unix.py
    ... ... @@ -31,7 +31,6 @@ class Unix(Platform):
    31 31
         def __init__(self, context):
    
    32 32
     
    
    33 33
             super().__init__(context)
    
    34
    -        self._artifact_cache = CASCache(context)
    
    35 34
     
    
    36 35
             # Not necessarily 100% reliable, but we want to fail early.
    
    37 36
             if os.geteuid() != 0:
    

  • buildstream/_project.py
    ... ... @@ -38,6 +38,7 @@ from ._loader import Loader
    38 38
     from .element import Element
    
    39 39
     from ._message import Message, MessageType
    
    40 40
     from ._includes import Includes
    
    41
    +from ._platform import Platform
    
    41 42
     
    
    42 43
     
    
    43 44
     # Project Configuration file
    
    ... ... @@ -385,7 +386,10 @@ class Project():
    385 386
                 self._project_conf = _yaml.load(projectfile)
    
    386 387
             except LoadError as e:
    
    387 388
                 # Raise a more specific error here
    
    388
    -            raise LoadError(LoadErrorReason.MISSING_PROJECT_CONF, str(e))
    
    389
    +            if e.reason == LoadErrorReason.MISSING_FILE:
    
    390
    +                raise LoadError(LoadErrorReason.MISSING_PROJECT_CONF, str(e)) from e
    
    391
    +            else:
    
    392
    +                raise
    
    389 393
     
    
    390 394
             pre_config_node = _yaml.node_copy(self._default_config_node)
    
    391 395
             _yaml.composite(pre_config_node, self._project_conf)
    
    ... ... @@ -614,7 +618,8 @@ class Project():
    614 618
             # Based on some testing (mainly on AWS), maximum effective
    
    615 619
             # max-jobs value seems to be around 8-10 if we have enough cores
    
    616 620
             # users should set values based on workload and build infrastructure
    
    617
    -        output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 8))
    
    621
    +        platform = Platform.get_platform()
    
    622
    +        output.base_variables['max-jobs'] = str(platform.get_cpu_count(8))
    
    618 623
     
    
    619 624
             # Export options into variables, if that was requested
    
    620 625
             output.options.export_variables(output.base_variables)
    

  • buildstream/sandbox/__init__.py
    ... ... @@ -21,3 +21,4 @@ from .sandbox import Sandbox, SandboxFlags
    21 21
     from ._sandboxchroot import SandboxChroot
    
    22 22
     from ._sandboxbwrap import SandboxBwrap
    
    23 23
     from ._sandboxremote import SandboxRemote
    
    24
    +from ._sandboxdummy import SandboxDummy

  • buildstream/sandbox/_mount.py
    ... ... @@ -30,7 +30,7 @@ from .._fuse import SafeHardlinks
    30 30
     # Helper data object representing a single mount point in the mount map
    
    31 31
     #
    
    32 32
     class Mount():
    
    33
    -    def __init__(self, sandbox, mount_point, safe_hardlinks):
    
    33
    +    def __init__(self, sandbox, mount_point, safe_hardlinks, fuse_mount_options={}):
    
    34 34
             scratch_directory = sandbox._get_scratch_directory()
    
    35 35
             # Getting _get_underlying_directory() here is acceptable as
    
    36 36
             # we're part of the sandbox code. This will fail if our
    
    ... ... @@ -39,6 +39,7 @@ class Mount():
    39 39
     
    
    40 40
             self.mount_point = mount_point
    
    41 41
             self.safe_hardlinks = safe_hardlinks
    
    42
    +        self._fuse_mount_options = fuse_mount_options
    
    42 43
     
    
    43 44
             # FIXME: When the criteria for mounting something and it's parent
    
    44 45
             #        mount is identical, then there is no need to mount an additional
    
    ... ... @@ -82,7 +83,7 @@ class Mount():
    82 83
         @contextmanager
    
    83 84
         def mounted(self, sandbox):
    
    84 85
             if self.safe_hardlinks:
    
    85
    -            mount = SafeHardlinks(self.mount_origin, self.mount_tempdir)
    
    86
    +            mount = SafeHardlinks(self.mount_origin, self.mount_tempdir, self._fuse_mount_options)
    
    86 87
                 with mount.mounted(self.mount_source):
    
    87 88
                     yield
    
    88 89
             else:
    
    ... ... @@ -100,12 +101,12 @@ class Mount():
    100 101
     #
    
    101 102
     class MountMap():
    
    102 103
     
    
    103
    -    def __init__(self, sandbox, root_readonly):
    
    104
    +    def __init__(self, sandbox, root_readonly, fuse_mount_options={}):
    
    104 105
             # We will be doing the mounts in the order in which they were declared.
    
    105 106
             self.mounts = OrderedDict()
    
    106 107
     
    
    107 108
             # We want safe hardlinks on rootfs whenever root is not readonly
    
    108
    -        self.mounts['/'] = Mount(sandbox, '/', not root_readonly)
    
    109
    +        self.mounts['/'] = Mount(sandbox, '/', not root_readonly, fuse_mount_options)
    
    109 110
     
    
    110 111
             for mark in sandbox._get_marked_directories():
    
    111 112
                 directory = mark['directory']
    
    ... ... @@ -113,7 +114,7 @@ class MountMap():
    113 114
     
    
    114 115
                 # We want safe hardlinks for any non-root directory where
    
    115 116
                 # artifacts will be staged to
    
    116
    -            self.mounts[directory] = Mount(sandbox, directory, artifact)
    
    117
    +            self.mounts[directory] = Mount(sandbox, directory, artifact, fuse_mount_options)
    
    117 118
     
    
    118 119
         # get_mount_source()
    
    119 120
         #
    

  • buildstream/sandbox/_sandboxchroot.py
    ... ... @@ -35,6 +35,9 @@ from . import Sandbox, SandboxFlags
    35 35
     
    
    36 36
     
    
    37 37
     class SandboxChroot(Sandbox):
    
    38
    +
    
    39
    +    _FUSE_MOUNT_OPTIONS = {'dev': True}
    
    40
    +
    
    38 41
         def __init__(self, *args, **kwargs):
    
    39 42
             super().__init__(*args, **kwargs)
    
    40 43
     
    
    ... ... @@ -67,7 +70,8 @@ class SandboxChroot(Sandbox):
    67 70
     
    
    68 71
             # Create the mount map, this will tell us where
    
    69 72
             # each mount point needs to be mounted from and to
    
    70
    -        self.mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY)
    
    73
    +        self.mount_map = MountMap(self, flags & SandboxFlags.ROOT_READ_ONLY,
    
    74
    +                                  self._FUSE_MOUNT_OPTIONS)
    
    71 75
             root_mount_source = self.mount_map.get_mount_source('/')
    
    72 76
     
    
    73 77
             # Create a sysroot and run the command inside it
    

  • buildstream/sandbox/_sandboxdummy.py
    1
    +#
    
    2
    +#  Copyright (C) 2017 Codethink Limited
    
    3
    +#
    
    4
    +#  This program is free software; you can redistribute it and/or
    
    5
    +#  modify it under the terms of the GNU Lesser General Public
    
    6
    +#  License as published by the Free Software Foundation; either
    
    7
    +#  version 2 of the License, or (at your option) any later version.
    
    8
    +#
    
    9
    +#  This library is distributed in the hope that it will be useful,
    
    10
    +#  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    11
    +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
    
    12
    +#  Lesser General Public License for more details.
    
    13
    +#
    
    14
    +#  You should have received a copy of the GNU Lesser General Public
    
    15
    +#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
    
    16
    +#
    
    17
    +#  Authors:
    
    18
    +
    
    19
    +from .._exceptions import SandboxError
    
    20
    +from . import Sandbox
    
    21
    +
    
    22
    +
    
    23
    +class SandboxDummy(Sandbox):
    
    24
    +    def __init__(self, *args, **kwargs):
    
    25
    +        super().__init__(*args, **kwargs)
    
    26
    +
    
    27
    +    def run(self, command, flags, *, cwd=None, env=None):
    
    28
    +
    
    29
    +        # Fallback to the sandbox default settings for
    
    30
    +        # the cwd and env.
    
    31
    +        #
    
    32
    +        cwd = self._get_work_directory(cwd=cwd)
    
    33
    +        env = self._get_environment(cwd=cwd, env=env)
    
    34
    +
    
    35
    +        if not self._has_command(command[0], env):
    
    36
    +            raise SandboxError("Staged artifacts do not provide command "
    
    37
    +                               "'{}'".format(command[0]),
    
    38
    +                               reason='missing-command')
    
    39
    +
    
    40
    +        raise SandboxError("This platform does not support local builds")

  • buildstream/utils.py
    ... ... @@ -35,6 +35,7 @@ import tempfile
    35 35
     import itertools
    
    36 36
     import functools
    
    37 37
     from contextlib import contextmanager
    
    38
    +from stat import S_ISDIR
    
    38 39
     
    
    39 40
     import psutil
    
    40 41
     
    
    ... ... @@ -328,27 +329,25 @@ def safe_remove(path):
    328 329
         Raises:
    
    329 330
            UtilError: In the case of unexpected system call failures
    
    330 331
         """
    
    331
    -    if os.path.lexists(path):
    
    332
    -
    
    333
    -        # Try to remove anything that is in the way, but issue
    
    334
    -        # a warning instead if it removes a non empty directory
    
    335
    -        try:
    
    332
    +    try:
    
    333
    +        if S_ISDIR(os.lstat(path).st_mode):
    
    334
    +            os.rmdir(path)
    
    335
    +        else:
    
    336 336
                 os.unlink(path)
    
    337
    -        except OSError as e:
    
    338
    -            if e.errno != errno.EISDIR:
    
    339
    -                raise UtilError("Failed to remove '{}': {}"
    
    340
    -                                .format(path, e))
    
    341
    -
    
    342
    -            try:
    
    343
    -                os.rmdir(path)
    
    344
    -            except OSError as e:
    
    345
    -                if e.errno == errno.ENOTEMPTY:
    
    346
    -                    return False
    
    347
    -                else:
    
    348
    -                    raise UtilError("Failed to remove '{}': {}"
    
    349
    -                                    .format(path, e))
    
    350 337
     
    
    351
    -    return True
    
    338
    +        # File removed/unlinked successfully
    
    339
    +        return True
    
    340
    +
    
    341
    +    except OSError as e:
    
    342
    +        if e.errno == errno.ENOTEMPTY:
    
    343
    +            # Path is non-empty directory
    
    344
    +            return False
    
    345
    +        elif e.errno == errno.ENOENT:
    
    346
    +            # Path does not exist
    
    347
    +            return True
    
    348
    +
    
    349
    +    raise UtilError("Failed to remove '{}': {}"
    
    350
    +                    .format(path, e))
    
    352 351
     
    
    353 352
     
    
    354 353
     def copy_files(src, dest, *, files=None, ignore_missing=False, report_written=False):
    

  • tests/format/project.py
    ... ... @@ -40,6 +40,13 @@ def test_invalid_project_name(cli, datafiles):
    40 40
         result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_SYMBOL_NAME)
    
    41 41
     
    
    42 42
     
    
    43
    +@pytest.mark.datafiles(os.path.join(DATA_DIR))
    
    44
    +def test_invalid_yaml(cli, datafiles):
    
    45
    +    project = os.path.join(datafiles.dirname, datafiles.basename, "invalid-yaml")
    
    46
    +    result = cli.run(project=project, args=['workspace', 'list'])
    
    47
    +    result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_YAML)
    
    48
    +
    
    49
    +
    
    43 50
     @pytest.mark.datafiles(os.path.join(DATA_DIR))
    
    44 51
     def test_load_default_project(cli, datafiles):
    
    45 52
         project = os.path.join(datafiles.dirname, datafiles.basename, "default")
    

  • tests/format/project/invalid-yaml/manual.bst
    1
    +kind: manual

  • tests/format/project/invalid-yaml/project.conf
    1
    +# Basic project configuration that doesnt override anything
    
    2
    +#
    
    3
    +
    
    4
    +name: pony
    
    5
    +
    
    6
    +variables:
    
    7
    +  sbindir: "%{bindir}
    
    8
    +

  • tests/integration/project/elements/integration.bst
    1
    +kind: manual
    
    2
    +depends:
    
    3
    +- base.bst
    
    4
    +
    
    5
    +public:
    
    6
    +  bst:
    
    7
    +    integration-commands:
    
    8
    +    - |
    
    9
    +      echo noise >/dev/null

  • tests/integration/shell.py
    ... ... @@ -342,3 +342,13 @@ def test_sysroot_workspace_visible(cli, tmpdir, datafiles):
    342 342
         ])
    
    343 343
         assert result.exit_code == 0
    
    344 344
         assert result.output == workspace_hello
    
    345
    +
    
    346
    +
    
    347
    +# Test system integration commands can access devices in /dev
    
    348
    +@pytest.mark.datafiles(DATA_DIR)
    
    349
    +def test_integration_devices(cli, tmpdir, datafiles):
    
    350
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    351
    +    element_name = 'integration.bst'
    
    352
    +
    
    353
    +    result = execute_shell(cli, project, ["true"], element=element_name)
    
    354
    +    assert result.exit_code == 0



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]