summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <chandan@chandansingh.net>2019-01-03 20:03:32 +0000
committerChandan Singh <chandan@chandansingh.net>2019-01-03 20:03:32 +0000
commit01c3761c3e51b61c77a78c354402764de1ad10e2 (patch)
tree353742deaade458d0ea9478681a515723f422796
parent669b55b008cd487fdeea0628eb248562f7679cd1 (diff)
parentca547f19b4f9c8709b4ea2642e3796284ab67cd0 (diff)
downloadbuildstream-01c3761c3e51b61c77a78c354402764de1ad10e2.tar.gz
Merge branch 'chandan/fix-bad-filename-mini-disaster' into 'master'
tests/frontend/buildcheckout.py: Fix bad filename issue for Windows Closes #842 See merge request BuildStream/buildstream!1032
-rw-r--r--tests/frontend/buildcheckout.py24
-rw-r--r--tests/frontend/project/elements/invalid-chars|<>-in-name.bst4
-rw-r--r--tests/testutils/site.py1
3 files changed, 24 insertions, 5 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index dc7ce6847..287fb6034 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -3,6 +3,7 @@ import tarfile
import hashlib
import pytest
from tests.testutils import cli, create_repo, ALL_REPO_KINDS, generate_junction
+from tests.testutils.site import IS_WINDOWS
from buildstream import _yaml
from buildstream._exceptions import ErrorDomain, LoadErrorReason
@@ -85,16 +86,37 @@ def test_build_invalid_suffix_dep(datafiles, cli, strict, hardlinks):
result.assert_main_error(ErrorDomain.LOAD, "bad-element-suffix")
+@pytest.mark.skipif(IS_WINDOWS, reason='Not available on Windows')
@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'))
+ element_name = 'invalid-chars|<>-in-name.bst'
+
+ # The name of this file contains characters that are not allowed by
+ # BuildStream, using it should raise a warning.
+ element = {
+ 'kind': 'stack',
+ }
+ _yaml.dump(element, os.path.join(project, 'elements', element_name))
+
+ result = cli.run(project=project, args=strict_args(['build', element_name], 'non-strict'))
result.assert_main_error(ErrorDomain.LOAD, "bad-characters-in-name")
+@pytest.mark.skipif(IS_WINDOWS, reason='Not available on Windows')
@pytest.mark.datafiles(DATA_DIR)
def test_build_invalid_filename_chars_dep(datafiles, cli):
project = os.path.join(datafiles.dirname, datafiles.basename)
+ element_name = 'invalid-chars|<>-in-name.bst'
+
+ # The name of this file contains characters that are not allowed by
+ # BuildStream, and is listed as a dependency of 'invalid-chars-in-dep.bst'.
+ # This should also raise a warning.
+ element = {
+ 'kind': 'stack',
+ }
+ _yaml.dump(element, os.path.join(project, 'elements', element_name))
+
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")
diff --git a/tests/frontend/project/elements/invalid-chars|<>-in-name.bst b/tests/frontend/project/elements/invalid-chars|<>-in-name.bst
deleted file mode 100644
index bc6a13110..000000000
--- a/tests/frontend/project/elements/invalid-chars|<>-in-name.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-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/testutils/site.py b/tests/testutils/site.py
index c7625cccf..6ef22babb 100644
--- a/tests/testutils/site.py
+++ b/tests/testutils/site.py
@@ -52,5 +52,6 @@ except ImportError:
HAVE_ARPY = False
IS_LINUX = os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('linux')
+IS_WINDOWS = (os.name == 'nt')
MACHINE_ARCH = Platform.get_host_arch()