summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorWilliam Salmon <will.salmon@codethink.co.uk>2019-06-05 14:22:34 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-12 06:57:52 +0000
commit33272aa7764c03f7d0b3a7b36f08636f883c3e69 (patch)
tree675034c2720fdf2fd80a3d6da29b77fab15e414e /tests/integration
parent24426ebe31fc2ad297b352a1d332c7cf158ef5c2 (diff)
downloadbuildstream-33272aa7764c03f7d0b3a7b36f08636f883c3e69.tar.gz
Refactor of Platform and Sandbox
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/build-uid.py8
-rw-r--r--tests/integration/cachedfail.py24
-rw-r--r--tests/integration/sandbox-bwrap.py8
3 files changed, 29 insertions, 11 deletions
diff --git a/tests/integration/build-uid.py b/tests/integration/build-uid.py
index 26f1bd2d4..66f9b3fbc 100644
--- a/tests/integration/build-uid.py
+++ b/tests/integration/build-uid.py
@@ -5,7 +5,7 @@ import os
import pytest
from buildstream.testing import cli_integration as cli # pylint: disable=unused-import
-from buildstream.testing._utils.site import HAVE_BWRAP, HAVE_SANDBOX, IS_LINUX
+from buildstream.testing._utils.site import HAVE_SANDBOX, IS_LINUX
pytestmark = pytest.mark.integration
@@ -16,7 +16,7 @@ DATA_DIR = os.path.join(
)
-@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
+@pytest.mark.skipif(not IS_LINUX or HAVE_SANDBOX != "bwrap", reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_build_uid_overridden(cli, datafiles):
project = str(datafiles)
@@ -35,7 +35,7 @@ def test_build_uid_overridden(cli, datafiles):
assert result.exit_code == 0
-@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubbelwrap')
+@pytest.mark.skipif(not IS_LINUX or HAVE_SANDBOX != "bwrap", reason='Only available on linux with bubbelwrap')
@pytest.mark.datafiles(DATA_DIR)
def test_build_uid_in_project(cli, datafiles):
project = str(datafiles)
@@ -55,7 +55,7 @@ def test_build_uid_in_project(cli, datafiles):
@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox')
+@pytest.mark.skipif(HAVE_SANDBOX != "bwrap", reason='Only available with a functioning sandbox')
def test_build_uid_default(cli, datafiles):
project = str(datafiles)
element_name = 'build-uid/build-uid-default.bst'
diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py
index a2273a06d..be7db3357 100644
--- a/tests/integration/cachedfail.py
+++ b/tests/integration/cachedfail.py
@@ -1,3 +1,19 @@
+#
+# Copyright (C) 2016 Codethink Limited
+# Copyright (C) 2019 Bloomberg Finance LP
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name
@@ -7,7 +23,7 @@ import pytest
from buildstream import _yaml
from buildstream._exceptions import ErrorDomain
from buildstream.testing import cli_integration as cli # pylint: disable=unused-import
-from buildstream.testing._utils.site import HAVE_BWRAP, HAVE_SANDBOX, IS_LINUX
+from buildstream.testing._utils.site import HAVE_SANDBOX
from tests.conftest import clean_platform_cache
from tests.testutils import create_artifact_share
@@ -167,7 +183,7 @@ def test_push_cached_fail(cli, tmpdir, datafiles, on_error):
assert share.has_artifact(cli.get_artifact_name(project, 'test', 'element.bst'))
-@pytest.mark.skipif(not (IS_LINUX and HAVE_BWRAP), reason='Only available with bubblewrap on Linux')
+@pytest.mark.skipif(HAVE_SANDBOX != 'bwrap', reason='Only available with bubblewrap on Linux')
@pytest.mark.datafiles(DATA_DIR)
def test_host_tools_errors_are_not_cached(cli, datafiles):
project = str(datafiles)
@@ -190,8 +206,10 @@ def test_host_tools_errors_are_not_cached(cli, datafiles):
}
_yaml.dump(element, element_path)
+ clean_platform_cache()
+
# Build without access to host tools, this will fail
- result1 = cli.run(project=project, args=['build', 'element.bst'], env={'PATH': ''})
+ result1 = cli.run(project=project, args=['build', 'element.bst'], env={'PATH': '', 'BST_FORCE_SANDBOX': None})
result1.assert_task_error(ErrorDomain.SANDBOX, 'unavailable-local-sandbox')
assert cli.get_element_state(project, 'element.bst') == 'buildable'
diff --git a/tests/integration/sandbox-bwrap.py b/tests/integration/sandbox-bwrap.py
index d08076f5a..f48c75cbd 100644
--- a/tests/integration/sandbox-bwrap.py
+++ b/tests/integration/sandbox-bwrap.py
@@ -7,7 +7,7 @@ import pytest
from buildstream._exceptions import ErrorDomain
from buildstream.testing import cli_integration as cli # pylint: disable=unused-import
-from buildstream.testing._utils.site import HAVE_BWRAP, HAVE_BWRAP_JSON_STATUS
+from buildstream.testing._utils.site import HAVE_SANDBOX, HAVE_BWRAP_JSON_STATUS
pytestmark = pytest.mark.integration
@@ -22,7 +22,7 @@ DATA_DIR = os.path.join(
# Bubblewrap sandbox doesn't remove the dirs it created during its execution,
# so BuildStream tries to remove them to do good. BuildStream should be extra
# careful when those folders already exist and should not touch them, though.
-@pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap')
+@pytest.mark.skipif(HAVE_SANDBOX != 'bwrap', reason='Only available with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_sandbox_bwrap_cleanup_build(cli, datafiles):
project = str(datafiles)
@@ -34,7 +34,7 @@ def test_sandbox_bwrap_cleanup_build(cli, datafiles):
assert result.exit_code == 0
-@pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap')
+@pytest.mark.skipif(HAVE_SANDBOX != 'bwrap', reason='Only available with bubblewrap')
@pytest.mark.skipif(not HAVE_BWRAP_JSON_STATUS, reason='Only available with bubblewrap supporting --json-status-fd')
@pytest.mark.datafiles(DATA_DIR)
def test_sandbox_bwrap_distinguish_setup_error(cli, datafiles):
@@ -45,7 +45,7 @@ def test_sandbox_bwrap_distinguish_setup_error(cli, datafiles):
result.assert_task_error(error_domain=ErrorDomain.SANDBOX, error_reason="bwrap-sandbox-fail")
-@pytest.mark.skipif(not HAVE_BWRAP, reason='Only available with bubblewrap')
+@pytest.mark.skipif(HAVE_SANDBOX != 'bwrap', reason='Only available with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_sandbox_bwrap_return_subprocess(cli, datafiles):
project = str(datafiles)