diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2018-12-31 17:51:09 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-12-31 19:54:25 +0000 |
commit | 4b2992c1a33f39cff4c0d77cf7d20ca107215059 (patch) | |
tree | 0f5cfe792717fc1ca140f09bb9b826d640667057 | |
parent | 87568074008e0b22d5d543312f3dd3278ca49bed (diff) | |
download | buildstream-4b2992c1a33f39cff4c0d77cf7d20ca107215059.tar.gz |
tests/buildcheckout.py: Add tests for invalid chars in filename
-rw-r--r-- | tests/frontend/buildcheckout.py | 14 | ||||
-rw-r--r-- | tests/frontend/project/elements/invalid-chars-in-dep.bst | 8 | ||||
-rw-r--r-- | tests/frontend/project/elements/invalid-chars|<>-in-name.bst | 4 | ||||
-rw-r--r-- | tests/frontend/project/project.conf | 1 |
4 files changed, 27 insertions, 0 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index 03bba0b26..dc7ce6847 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -86,6 +86,20 @@ def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks): @pytest.mark.datafiles(DATA_DIR) +def test_build_invalid_filename_chars(datafiles, cli): + project = os.path.join(datafiles.dirname, datafiles.basename) + result = cli.run(project=project, args=strict_args(['build', 'invalid-chars|<>-in-name.bst'], 'non-strict')) + result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name") + + +@pytest.mark.datafiles(DATA_DIR) +def test_build_invalid_filename_chars_dep(datafiles, cli): + project = os.path.join(datafiles.dirname, datafiles.basename) + result = cli.run(project=project, args=strict_args(['build', 'invalid-chars-in-dep.bst'], 'non-strict')) + result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name") + + +@pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("deps", [("run"), ("none"), ("build")]) def test_build_checkout_deps(datafiles, cli, deps): project = os.path.join(datafiles.dirname, datafiles.basename) diff --git a/tests/frontend/project/elements/invalid-chars-in-dep.bst b/tests/frontend/project/elements/invalid-chars-in-dep.bst new file mode 100644 index 000000000..6a5ec30c8 --- /dev/null +++ b/tests/frontend/project/elements/invalid-chars-in-dep.bst @@ -0,0 +1,8 @@ +kind: stack +description: | + + This element itself has a valid name, but depends on elements that have + invalid names. This should also result in a warning. + +depends: +- invalid-chars|<>-in-name.bst diff --git a/tests/frontend/project/elements/invalid-chars|<>-in-name.bst b/tests/frontend/project/elements/invalid-chars|<>-in-name.bst new file mode 100644 index 000000000..bc6a13110 --- /dev/null +++ b/tests/frontend/project/elements/invalid-chars|<>-in-name.bst @@ -0,0 +1,4 @@ +kind: stack +description: | + The name of this files contains characters that are not allowed by + BuildStream, using it should raise a warning. diff --git a/tests/frontend/project/project.conf b/tests/frontend/project/project.conf index a7e4a023c..ed18221e4 100644 --- a/tests/frontend/project/project.conf +++ b/tests/frontend/project/project.conf @@ -5,3 +5,4 @@ element-path: elements fatal-warnings: - bad-element-suffix +- bad-characters-in-name |