summaryrefslogtreecommitdiff
path: root/morphlib/cachekeycomputer_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* unittests: Make the unittests use morphloaderAdam Coldrick2014-08-141-63/+55
| | | | | This commit removes all use of morph2 from the unittests, replacing it with morphloader/morph3. It also converts the test morphologies to YAML.
* unittests: Test that the description field is ignored for chunksAdam Coldrick2014-07-221-3/+6
|
* CacheKeyComputer Tests: Update to explicitly test for memoisationbaserock/danielsilverstone/memoise-cache-keys-betterDaniel Silverstone2014-03-281-0/+13
| | | | | | | | | | Explicitly test that we get the same result twice when computing ids and keys for the same artifact. This has the effect of verifying that the memoisation code is correctly operating. Signed-Off-By: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
* unit tests: Fix invalid morphologiesRichard Maw2014-01-151-7/+9
| | | | | | | | | | | | | | | Later validation work causes the morphologies to be validated, when they weren't previously. This would cause the test suite to not pass, since the morphologies defined in the tests are malformed. One common problem was tests that, instead of a name field, had the name of the morpholgy in a field called "chunk". There were a few cases of new fields being needed, since the tests were written before they became mandatory. The most interesting failure was a Source being created, which instead of being passed a morphology object, was passed a string.
* One 'arch' to rule them allSam Thursfield2013-03-151-4/+3
| | | | | | | | | | | | | Define a specific set of 4 architectures that Morph supports, and only expose that value to morphologies. Since GNU triplets are very common we also expose a GNU triplet. Other morphologies should work out their configuration based on MORPH_ARCH. This commit also removes the morphlib.util.arch() function, which detected the machine Morph is running on via 'uname -m'. Morph's architecture names do not necessarily map to the output of 'uname -m' so we should not rely on it anywhere.
* Add 'prefix' property for chunks within strataSam Thursfield2013-03-131-1/+0
| | | | | | | | | Morph no longer supports setting the prefix using the --prefix argument / setting. This was only used in tests and during bootstrap. If a chunk build-depends on a chunk within a stratum which has a custom prefix, that prefix is appended to the PATH in the build environment.
* Set environment variables defining target for build-essentialSam Thursfield2013-03-131-6/+6
| | | | | | In the future we will allow this to be modified to provide a cross-bootstrap mode, but for now we use the same target as the host compiler.
* Refactor build processSam Thursfield2013-03-131-8/+3
| | | | | | | | | | | | | | | | | | Reorganise the build_artifact() and build_artifacts() functions to allow more complex work when setting up chunk builds in build_artifact(). The staging area now holds the BuildEnvironment object (the environment variables that should be set during build). This makes sense because all build commands should be run inside the staging area and therefore through the StagingArea object. The BuildEnvironment object is now considered immutable after it is created. The environment is used in cache key computation when computing what artifacts are required; if it changes after that point we risk either computing different artifact keys for the same artifact or missing data in the cache key that should be included in the hash. Better to force changes into a separate 'extra_env' variable.
* Test source pool having duplicates addedRichard Maw2012-12-031-0/+9
| | | | | The lookup method will only find the first entry, but previously would allow later entries to be found by iterating.
* Amend test to not add the same source to the pool twiceRichard Maw2012-12-031-2/+7
| | | | | | | | The test relied on undesired behaviour, since it would create the same source, since the sha1 is not used in the sourcepool's key. Now it creates a new source pool and replaces the source it is being compared to.
* Resolve tree SHA1 along with commit SHA1 when resolving refsJannis Pohlmann2012-09-051-2/+2
| | | | Adjust all other parts and the tests to work with this.
* Strata should be referred to with full repo/ref/morph tripletsSam Thursfield2012-08-301-2/+10
| | | | | | | | This removes the requirement that all strata must be in the same repo as the system morphology. Both the system "strata" field and the stratum "build-depends" field are affected.
* Strata contain "chunks", not "sources"Sam Thursfield2012-08-291-2/+2
| | | | Rename "sources" field of stratum morphologies to "chunks".
* python scripts: pep8ize codebaseRichard Maw2012-08-011-25/+26
| | | | | | | | | This was done with the aid of the pep8 script, available by running `easy_install pep8`. It may be worth making this part of ./check, but that will require putting pep8 into the development tools stratum. This should be easy, given pep8 has no external dependencies.
* Have MorphologyFactory set Morphology.builds_artifactsLars Wirzenius2012-07-181-0/+8
| | | | | | | | | | | | | This way we can have one place in the code where we determine what artifacts get built from a specific morphology, rather than spreading the information around the code base. From now on, everything is supposed to use the builds_artifacts attribute to get the list of artifacts. ArtifactResolver has been changed to do that. Some of the tests are now a bit messier, and should really be changed to create Morphology objects using MorphologyFactory, but that's a change for another day.
* tests: fix up for change in artifact nameRichard Maw2012-07-031-4/+4
| | | | | This fixes references to a system artifact without the -rootfs appended and adds a unit test for resolving an arm system artifact.
* CacheKeyComputer: re-use dict hash logic for morphology hashingRichard Maw2012-05-181-13/+0
| | | | | | CacheKeyComputer already re-invents the wheel for hashing a dict, so re-use that logic rather than re-implement it as creating a huge string.
* Fix stringifying morphologies to be deterministicLars Wirzenius2012-05-111-0/+14
| | | | | | | Previously we were stringifying complex values (lists, dicts) by using whatever Python produces, but different runs and versions of Python may convert them differently, particularly dicts. We now do it manually.
* Change cache keys for strata, systems to use sha of morphology, instead of ↵Lars Wirzenius2012-05-091-0/+18
| | | | | | | | | | commit This avoids a problem where we make a change to one system morphology in the "morphs" repository, and then we have to rebuild all system and stratum artifacts, because their commit sha1 also changed. With this change, we don't care about the commit sha1 for systems and strata, just the contents of the morphologies.
* Remove BuildGraph, compute cache keys based on Artifacts.Jannis Pohlmann2012-04-181-11/+24
| | | | | | | | | | | | With this commit, the ArtifactResolver no longer computes the cache keys when creating Artifact objects. This will have to happen as a post-resolving step (e.g. prior to building or checking whether a local or remote artifact cache has any of the resolved artifacts). The CacheKeyComputer now takes an Artifact object and computes the cache keys using its dependencies. BuildGraph is no longer needed for the CacheKeyComputer unit tests.
* Add a repo_name to Source, use that instead of repo in most places.Jannis Pohlmann2012-04-181-2/+1
| | | | | | | | | | This is because we will need to integrate a RemoteRepoCache and we don't always want to create a CachedRepo object (in fact, we only want that for the sources of artifacts we actually need to build). So we'll use either the local or the remote repo cache to resolve refs and morphology texts and then later, when actually caching a repo, we'll set the source.repo member to a CachedRepo object that we can then use to unpack the sources.
* Add original_name member to CachedRepo. Use it for SourcePool lookups.Jannis Pohlmann2012-04-171-1/+2
| | | | | | This is done to avoid a nasty mix of SourcePool lookups using CachedRepo objects (e.g. for strata within a system) versus lookups using repo names (e.g for sources within a stratum).
* cachekeycomputer: rename get_cache_key compute_keyRichard Maw2012-04-161-9/+41
| | | | | Also amend tests to operate on a dependency chain starting from a system morph
* cachekeycomputer tests: clean up different_keyRichard Maw2012-04-121-16/+24
| | | | | | Rather than poking the internals of both the build_environment and cachekeycomputer classes to change the environment, make a new build environment and cache key computer with a different environment
* cachekeycomputer: prepare build environment changeRichard Maw2012-04-121-15/+17
| | | | | | CacheKeyComputer needs to know some stuff that is needed elsewhere as well. Rather than duplicate the storage, have a BuildEnvironment class to handle that.
* morphlib: add cachekeycomputer classRichard Maw2012-04-121-0/+95