[Notes] [Git][BuildStream/buildstream][master] 3 commits: element.py: Fix cache check in non-strict mode



Title: GitLab

Jürg Billeter pushed to branch master at BuildStream / buildstream

Commits:

3 changed files:

Changes:

  • buildstream/element.py
    ... ... @@ -2084,7 +2084,7 @@ class Element(Plugin):
    2084 2084
         #
    
    2085 2085
         # Raises an error if the artifact is not cached.
    
    2086 2086
         #
    
    2087
    -    def __assert_cached(self, keystrength=_KeyStrength.STRONG):
    
    2087
    +    def __assert_cached(self, keystrength=None):
    
    2088 2088
             assert self.__is_cached(keystrength=keystrength), "{}: Missing artifact {}".format(
    
    2089 2089
                 self, self._get_brief_display_key())
    
    2090 2090
     
    

  • tests/frontend/project/elements/rebuild-target.bst
    1
    +kind: compose
    
    2
    +
    
    3
    +build-depends:
    
    4
    +- target.bst

  • tests/frontend/rebuild.py
    1
    +import os
    
    2
    +import pytest
    
    3
    +from tests.testutils import cli
    
    4
    +
    
    5
    +# Project directory
    
    6
    +DATA_DIR = os.path.join(
    
    7
    +    os.path.dirname(os.path.realpath(__file__)),
    
    8
    +    "project",
    
    9
    +)
    
    10
    +
    
    11
    +
    
    12
    +def strict_args(args, strict):
    
    13
    +    if strict != "strict":
    
    14
    +        return ['--no-strict'] + args
    
    15
    +    return args
    
    16
    +
    
    17
    +
    
    18
    +@pytest.mark.datafiles(DATA_DIR)
    
    19
    +@pytest.mark.parametrize("strict", ["strict", "non-strict"])
    
    20
    +def test_rebuild(datafiles, cli, strict):
    
    21
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    22
    +    checkout = os.path.join(cli.directory, 'checkout')
    
    23
    +
    
    24
    +    # First build intermediate target.bst
    
    25
    +    result = cli.run(project=project, args=strict_args(['build', 'target.bst'], strict))
    
    26
    +    result.assert_success()
    
    27
    +
    
    28
    +    # Modify base import
    
    29
    +    with open(os.path.join(project, 'files', 'dev-files', 'usr', 'include', 'new.h'), "w") as f:
    
    30
    +        f.write("#define NEW")
    
    31
    +
    
    32
    +    # Rebuild base import and build top-level rebuild-target.bst
    
    33
    +    # In non-strict mode, this does not rebuild intermediate target.bst,
    
    34
    +    # which means that a weakly cached target.bst will be staged as dependency.
    
    35
    +    result = cli.run(project=project, args=strict_args(['build', 'rebuild-target.bst'], strict))
    
    36
    +    result.assert_success()



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