summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Cache Keys: Update to use JSON rather than pickledanielsilverstone-ct/json-cache-keyDaniel Silverstone2019-02-1429-29/+29
| | | | | | | | This affects the cache key version (updated to 7) and introduces a dependency on `ujson` which is BSD licenced as of the version locked in `requirements.txt` Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
* Provide configuration for the optional creation of buildtreestpollard/896Tom Pollard2019-02-132-1/+178
| | | | | | | | | | | | | | | | | | | | | Artifacts can be cached explicitly with an empty `build tree` when built via the cli main options or user config for all or only successful build artifacts. Default behaviour is to still create and cache all expected buildtrees. element.py: _cache_artifact() Check if context for cache_buildtrees has been set to always or failure with a corresponding build result, if not skip attempting to export the build-root. Element types without a build-root are cached with an empty buildtree regardless. Update _stage_sources_at() to warn the user that the buildtree import is empty. tests/integration: Add test to artifact.py for the optional caching of buildtree content from bst build. Rename build-tree.py to shellbuildtrees.py to reflect included test cases, add test for empty buildtree warning and failure option. NEWS: Add entry for new option.
* Add cli main & user conf option for 'cache-buildtrees' contextTom Pollard2019-02-131-0/+2
| | | | | | | | | | | | | _context.py: Add cache_buildtrees global user context, the default of which is set to by default to 'always' via the addition of cache-buildtrees to userconfig.yaml cache group. 'failure' & 'never' can be given as valid options. app.py & cli.py: Add --cache-buildtrees as a bst main option, which when passed with a valid option can override the default or user defined context for cache_buildtrees. tests/completions/completions.py: Update for the added flag.
* utils.py: Return all directories in list_relative_paths()Jürg Billeter2019-02-1314-14/+14
| | | | | | | | | | | | | | | Returning only empty directories leads to inconsistencies when computing a manifest by combining results from multiple list_relative_paths() calls as done by the compose plugin. I.e., the same directory may be empty in one dependency and non-empty in another dependency. The merged file list will still contain that directory even though it's no longer empty. This inconsistency causes problems when calculating differences between manifests. Returning all directories fixes these inconsistencies. This is a change in API behavior.
* tests/integration/project: Add tests directory to split ruleJürg Billeter2019-02-131-0/+2
| | | | | This is required to fix tests with the following commit that changes list_relative_paths() to return all directories.
* projectconfig.yaml: Consistently include directories in split rulesJürg Billeter2019-02-1329-29/+29
| | | | | | | | | Most split rules already included the relevant directories themselves in addition to the directory contents. Add the missing bin, sbin, and libexec directories. This is required to fix tests with the following commit that changes list_relative_paths() to return all directories.
* element.py: Lift ArtifactCache.get_artifact_fullname() to hereJames Ennis2019-02-132-2/+2
| | | | | | | | This commit removes the method ArtifactCache.get_artifact_fullname() and replaces it with Element.get_artifact_name() Given a key, we are now able to construct the full name of any of an element's artifacts.
* buildstream/_cas/cascache.py: Set 0644 rights to pulled filesvalentindavid/pull-chmod-bugValentin David2019-02-121-0/+72
| | | | This was broken by 5ef19a0b31df84caed1e41719ef7ea5c6bd8a8bc.
* _frontend: Allow printing dependencies using `bst show`Chandan Singh2019-02-121-0/+25
| | | | | | | | | | | | | | | | | | At present, there isn't an easy way to print anything from `bst show` that would give the users an idea of what the dependency graph looks like. One could use things like `--deps build`, but that will just print a list, without any information about the dependency edges. Add `%{deps}`, `%{build-deps}` and `%{runtime-deps}` format strings to `bst show` that would simply print the list of all dependencies, build dependencies and runtime dependencies respectively. Summary of changes: * buildstream/_frontend/cli.py: Add help for new format symbols. * buildstream/_frontend/widget.py: Add support for new format symbols for dependencies. * tests/frontend/show.py: Add tests for new format symbols.
* tests/format/include: remove unused tmpdir'saevri/include-errorAngelos Evripiotis2019-02-111-6/+6
| | | | | Don't create and remove temp dirs unnecessarily when they are not used, looks like these were just copy-pastes without intended side-effects.
* _includes: better error on including directoryAngelos Evripiotis2019-02-111-0/+21
| | | | | | | | | | | | | Previously, include a directory result in an error like this: mydir is a directory. bst command expects a .bst file. Note that the file containing the include was not mentioned. Now we get an error like this instead: element.bst [line 12 column 0]: Include block references a directory instead of a file: 'mydir'.
* _includes: better error on missing includeAngelos Evripiotis2019-02-111-0/+20
| | | | | | | | | | | | | Previously, a missing include would result in an error like this: Could not find file at not-a-file.include Note that the file containing the include was not mentioned. Now we get an error like this instead: element.bst [line 7 column 5]: Include block references a file that could not be found: 'not-a-file.include'.
* _includes: better provenance on recursive includeAngelos Evripiotis2019-02-111-1/+2
| | | | Use the provenance of the include block, instead of the whole node.
* tests/sources/local.py: Add directory symlink testJürg Billeter2019-02-111-0/+20
|
* Expose basic api for testing external plugins.phil/plugin-testing-apiPhil Dawson2019-02-0898-766/+158
| | | | | | | | | | | | | | | | | | We want external plugins to be able to make use of the core testing utils. This commit exposes the basic utilities which are currently in use in bst-external plugins. If necessary, more utilities could be exposed in the future. Moves the following files from tests/testutils/ to buildstream/plugintestingutils/: o runcli.py o integration.py As part of this, this commit makes the following changes to runcli.py and integration.py: o runcli.py: Fix linting errors o runcli.py: Add user facing documentation o Integration.py: Add user facing documentation
* Add more log formatting optionsWilliam Salmon2019-02-071-2/+4
| | | | The 'wallclock-us' is a option that we thought we already had.
* tests: Fix test failures caused by unix sockets' path length limitjonathan/wsl-testsJonathan Maw2019-02-061-1/+8
| | | | | | The unix specification for unix sockets only allocates ~100 characters for the length of the path. This may be longer than the path for a CI runner, or the path to a user's buildstream directory.
* tests: Skip tests that use sandboxes on WSLJonathan Maw2019-02-0620-85/+96
|
* Add --remote, -r option to bst build, inline with pull & pushTom Pollard2019-02-053-1/+85
| | | | | | Providing a remote will limit build's pull/push remote actions to the given remote specifically, ignoring those defined via user or project configuration.
* filter.py: Fail if declared domains do not exist in the parent elementjennis/warn_for_nonexistent_domainsJames Ennis2019-02-043-1/+20
| | | | | | | | | This patch also uncovered the fact that our test_filter_deps_ok() test has been inaccurate. Thus the element built in this test (deps-permitted.bst) has been modified so that it build depends on the input.bst element, as it should. tests/filter.py: Ensure deps_ok test passes
* tests/cachekey: Test cache keys are independent of target elementsphil/cache-key-stability-testPhil Dawson2019-02-016-0/+66
|
* testutils/site.py: Support parsing more exotic git versionsChandan Singh2019-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | We use output of `git --version` to determine if we can run some tests that rely on features from newer git versions. Usually, we expect the output to be like: git version 2.17.2 On some platforms, like MacOS, there could be a suffix after the version string, so that it looks something like: git version 2.17.2 (Apple Git-113) This causes things to fail like so: ValueError: invalid literal for int() with base 10: '2 (Apple Git-113)\n' Fix logic around `HAVE_OLD_GIT` such that we split the output of `git --version` without limit on how many times we split. Previously we used to split only twice so the suffixes like `(Apple Git-113)` are not part of the parsed version.
* filter.py: don't recurse when staging dependenciesDor Askayo2019-01-303-0/+39
| | | | | | | Also bump the element's version so cached artifacts would be invalidated. Fixes #883
* Download buildtrees on demand for bst shell --use-buildtreetpollard/829Tom Pollard2019-01-281-11/+37
| | | | | | | | | | | | | | | | | Provide bst shell --use-buildtree the ability to attempt to acquire missing buildtrees, given respective option, user pull-buildtree context and remote availability. _frontend/cli.py: Refactor logic for determining --use-buildtree option with given opportunity to attempt pulling a non-local buildtree. Element loaded with artifact_config to allow remote querying. _stream.py: With given user option and element state, construct PullQueue to fetch remote buildtree. Continue or Error without buildtree if cannot be attained. tests/integration/build-tree.py: Update to support new usecases
* Fixup refs to 'bst track'Angelos Evripiotis2019-01-281-1/+1
| | | | | Now that 'bst track' is obsolete, change guidance to refer to the replacement 'bst source track' instead.
* _artifactcache.py: Don't require the quota to be available on disk.tristan/cache-quota-max-onlyTristan Van Berkom2019-01-251-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead only rely on the headroom to be enough to protect against out of space conditions. The headroom can become configurable as a separate step is required. The changes to achieve this are: * Rename ArtifactCache.has_quota_exceeded() to ArtifactCache.full(). * ArtifactCache.full() now also reports True if the available space on the artifact cache volume is smaller than the headroom. This ensures jobs get triggered to cleanup the cache when reaching the end of the disk. * When loading the artifact quota, it is now only an error if the quota exceeds the overall disk space, not if it does not fit in the available space. It is still a warning if the quota does not fit in the available space on the artifact cache volume. * Updated scheduler.py and buildqueue.py for the API rename * tests: Updated the artifactcache/expiry.py test for its expectations in this regard. Added a new test to test an error when quota was specified to exceed total disk space, and adjusted the existing tests to expect a warning when the quota does not fit in the available space. This fixes issue #733 and #869.
* _artifactcache.py: Refactored to use utils._get_volume_size()Tristan Van Berkom2019-01-242-3/+3
| | | | | | | | | | | | | | | | | | | | | This will benefit from a better UtilError being raised, and and turns the artifact cache's local function into a one liner. The loop which finds the first existing directory in the given path has been removed, being meaningless due to the call to os.makedirs() in ArtifactCache.__init__(). The local function was renamed to _get_cache_volume_size() and no longer takes any arguments, which is more suitable for the function as it serves as a testing override surface for unittest.mock(). The following test cases which use the function to override the ArtifactCache behavior have been updated to use the new overridable function name: tests/artifactcache/cache_size.py tests/artifactcache/expiry.py
* tests/artifactcache/expiry.py: Test that expiry happens firsttristan/cache-managementTristan Van Berkom2019-01-241-0/+64
|
* _frontend/widget.py: Render core messages more like other messagesTristan Van Berkom2019-01-241-2/+2
| | | | | | | | | | | | | | In order to test when core activities occur by parsing the stderr in tests, we should make the messages conform more. At the same time, this restores alignment of columns in core messages with the element processing related messages. Also, _scheduler/scheduler.py is updated to make it's activity names conform to the (current) 5 character limit for the sake of alignment. The tests/frontend/logging.py test gets it's regexes updated for the log lines it checks for in stderr.
* tests/frontend/buildcheckout.py: Add default target test with junctionJürg Billeter2019-01-244-0/+56
| | | | | Test that `bst build` does not fail in a project where the list of default targets includes a junction (junctions cannot be built).
* tests/frontend/pull.py: Add default target test for bst push/pullJürg Billeter2019-01-241-0/+50
|
* tests/frontend/fetch.py: Add default target test for bst source fetchJürg Billeter2019-01-241-0/+35
|
* tests/frontend: Add default target tests for bst show and buildPhillip Smyth2019-01-2419-0/+179
|
* tests: Test that fetching an open workspace will fetch its dependenciesJonathan Maw2019-01-241-21/+34
| | | | | Previously, there was no way of detecting whether fetching happened, as an element with an open workspace will not be fetched.
* Test that tracking in workspaces actually worksJonathan Maw2019-01-241-4/+12
| | | | | Previously, it merely tested that buildstream did not fall other, rather than whether it did anything useful.
* tests/frontend/track.py: test_track_error_cannot_write_file() fixupTristan Van Berkom2019-01-241-4/+3
| | | | | | | | | This tests how BuildStream reacts when it fails to write the tracking results to the element files or project.refs file, which is an operation that plugins do not play a part in. As such, removing the per repo kind parameterization from this test as multiple runs are redundant here.
* tests/frontend/workspace.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-12/+16
|
* tests/frontend/track.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-8/+12
|
* tests/frontend/push.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-6/+9
|
* tests/frontend/pull.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-4/+4
|
* tests/sources/remote.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-6/+13
|
* tests/elements/filter.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-4/+6
|
* tests/artifactcache/expiry.py: Refactored to use get_element_states()Tristan Van Berkom2019-01-241-23/+30
|
* tests/testutils/runcli.py: Make get_element_states() take a list of targetsTristan Van Berkom2019-01-242-5/+4
| | | | | Instead of a single target, we can always provide a single target in a list.
* _artifactcache.py: Raise ArtifactError() when quota size exceeds disk space.tristan/insufficient-storage-errorTristan Van Berkom2019-01-232-16/+24
| | | | | | | | | | | | | | | | | | | | | | This is not an error related to loading data, like a parse error in the quota specification is, but a problem raised by the artifact cache - this allows us to assert more specific machine readable errors in test cases (instead of checking the string in stderr, which this patch also fixes). This also removes a typo from the error message in the said error. * tests/artifactcache/cache_size.py Updated test case to expect the artifact error, which consequently changes the test case to properly assert a machine readable error instead of asserting text in the stderr (which is the real, secret motivation behind this patch). * tests/artifactcache/expiry.py: Reworked test_invalid_cache_quota() Now expect the artifact error for the tests which check configurations which create caches too large to fit on the disk.
* tests: Migrated cache quota test into artifactcache/cache_size.pyTristan Van Berkom2019-01-232-34/+28
| | | | Instead of sitting mysteriously alone in internals/utils.py
* tests/integration/pullbuildtrees.py: Fix the non-integration case.Tristan Van Berkom2019-01-221-42/+42
| | | | | | | | | | This test has one test case which is marked as an integration test, and the other is not an integration test, but was using the integration cli. The integration cli does not work correctly if not run in integration mode. This was causing an error locally in conftest.py when trying to create a tmpdir inside a nonexisting integration cache directory.
* Mark 'old' checkout command as obsoleteJames Ennis2019-01-2236-120/+128
| | | | | | | | | | | This commit marks 'bst checkout' as a 'hidden' command. If used, the user will be prompted to use the new 'bst artifact checkout' command. All tests which used 'bst checkout' have been modified to use the new artifact sub-command. This partially solves #822.
* Move push and pull to the new artifact subcommand groupJames Ennis2019-01-2210-48/+50
| | | | | This commit also ensures that if we try to use the 'old' commands, BuildStream will fail and instruct the user to use the new command.
* tests/sources/git.py: Skip tests that assume too new a gitRichard Maw2019-01-212-1/+8
| | | | | | | | | | | | | | | | | test_track_invalid_submodule depends on being able to remove a submodule by `git rm $submoduledir`, but old versions of git don't update .gitmodules so BuildStream still thinks there's a submodule present. For expediency the test is skipped rather than changed to manually remove the entry from .gitmodules if git hasn't done it, since in the common case git is new enough to do that itself. test_git_describe expects --first-parent to find another tag, but `bst track` will gracefully degrade if the option doesn't work so a different history will be retained with old versions of git. It's of marginal benefit to add additional cruft to test for different output on old versions of git that won't persist forever.