diff options
author | Jürg Billeter <j@bitron.ch> | 2020-09-08 19:22:11 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-09-08 19:49:24 +0200 |
commit | d2265d2535f02ecb9a6a8e3dc9e6649ffea8bd3c (patch) | |
tree | cebc28e5dfaeb31ad5299a71c58b7e3c68dc1949 | |
parent | 68e9025185b5770016cbe6a5e7eaf4388a629e4c (diff) | |
download | buildstream-juerg/cache-key.tar.gz |
tests/frontend/buildcheckout.py: Add non-strict cache key testjuerg/cache-key
This is a regression test for the previously broken dependency cache key
check in non-strict mode.
-rw-r--r-- | tests/frontend/buildcheckout.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index 7c1f910b6..5afa5216d 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -115,6 +115,40 @@ def test_non_strict_build_strict_checkout(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) +def test_non_strict_pull_build_strict_checkout(datafiles, cli, tmpdir): + project = str(datafiles) + checkout = os.path.join(cli.directory, "checkout") + + # Target with at least one (indirect) build-only dependency + element_name = "target.bst" + + with create_artifact_share(os.path.join(str(tmpdir), "artifactshare")) as share: + + cli.configure({"artifacts": {"url": share.repo}}) + + # First build it in non-strict mode with an artifact server configured. + # With this configuration BuildStream will attempt to pull the build-only + # dependencies after attempting to pull the target element. This means + # that the cache key calculation of the target element has to be deferred + # until the pull attempt of the build-only dependencies, exercising a + # different code path. + # As this is a clean build from scratch, the result and also the cache keys + # should be identical to a build in strict mode. + result = cli.run(project=project, args=["--no-strict", "build", element_name]) + result.assert_success() + + # Now check it out in strict mode. + # This verifies that the clean build in non-strict mode produced an artifact + # matching the strict cache key. + result = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout]) + result.assert_success() + + # Check that the executable hello file is found in the checkout + filename = os.path.join(checkout, "usr", "bin", "hello") + assert os.path.exists(filename) + + +@pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("strict,hardlinks", [("non-strict", "hardlinks"),]) def test_build_invalid_suffix(datafiles, cli, strict, hardlinks): project = str(datafiles) |