[Notes] [Git][BuildStream/buildstream][element-path_not_validated] 2 commits: Fix for "element-path" not validated before use



Title: GitLab

Phillip Smyth pushed to branch element-path_not_validated at BuildStream / buildstream

Commits:

3 changed files:

Changes:

  • buildstream/_project.py
    ... ... @@ -402,6 +402,18 @@ class Project():
    402 402
                     "Project requested format version {}, but BuildStream {}.{} only supports up until format version {}"
    
    403 403
                     .format(format_version, major, minor, BST_FORMAT_VERSION))
    
    404 404
     
    
    405
    +        _yaml.node_validate(pre_config_node, [
    
    406
    +            'format-version',
    
    407
    +            'element-path', 'variables',
    
    408
    +            'environment', 'environment-nocache',
    
    409
    +            'split-rules', 'elements', 'plugins',
    
    410
    +            'aliases', 'name',
    
    411
    +            'artifacts', 'options',
    
    412
    +            'fail-on-overlap', 'shell', 'fatal-warnings',
    
    413
    +            '(@)', 'sources',
    
    414
    +            'ref-storage', 'sandbox', 'mirrors', 'remote-execution'
    
    415
    +        ])
    
    416
    +
    
    405 417
             # FIXME:
    
    406 418
             #
    
    407 419
             #   Performing this check manually in the absense
    

  • tests/frontend/invalid_element_path/project.conf
    1
    +# Project config for frontend build test
    
    2
    +name: test
    
    3
    +
    
    4
    +elephant-path: elements

  • tests/frontend/show.py
    ... ... @@ -36,6 +36,19 @@ def test_show(cli, datafiles, target, format, expected):
    36 36
                                  .format(expected, result.output))
    
    37 37
     
    
    38 38
     
    
    39
    +@pytest.mark.datafiles(os.path.join(
    
    40
    +    os.path.dirname(os.path.realpath(__file__)),
    
    41
    +    "invalid_element_path",
    
    42
    +))
    
    43
    +def test_show_invalid_element_path(cli, datafiles):
    
    44
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    45
    +    result = cli.run(project=project, silent=True, args=[
    
    46
    +        'show',
    
    47
    +        "foo.bst"])
    
    48
    +
    
    49
    +    result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
    
    50
    +
    
    51
    +
    
    39 52
     @pytest.mark.datafiles(DATA_DIR)
    
    40 53
     @pytest.mark.parametrize("target,except_,expected", [
    
    41 54
         ('target.bst', 'import-bin.bst', ['import-dev.bst', 'compose-all.bst', 'target.bst']),
    



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