summaryrefslogtreecommitdiff
path: root/morphlib/morphologyfactory_tests.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-13 16:24:59 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-15 11:04:55 +0000
commitf1cdf64cd5fa4271403286271ead511989ce15a1 (patch)
tree4b02dc53e10770da9aca05fb6e166bf020a55e26 /morphlib/morphologyfactory_tests.py
parent89c0777fa1c8918f8402b64484b16b6c715c441b (diff)
downloadmorph-f1cdf64cd5fa4271403286271ead511989ce15a1.tar.gz
One 'arch' to rule them all
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.
Diffstat (limited to 'morphlib/morphologyfactory_tests.py')
-rw-r--r--morphlib/morphologyfactory_tests.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py
index 30cfb8fb..08adcae2 100644
--- a/morphlib/morphologyfactory_tests.py
+++ b/morphlib/morphologyfactory_tests.py
@@ -73,7 +73,7 @@ class FakeLocalRepo(object):
}
def __init__(self):
- self.arch = 'unknown'
+ self.arch = 'x86_64'
self.system_kind = 'unknown'
def cat(self, sha1, filename):
@@ -219,7 +219,7 @@ class MorphologyFactoryTests(unittest.TestCase):
self.assertEqual(morph.builds_artifacts, ['stratum'])
def test_sets_build_artifacts_for_system(self):
- self.lr.arch = 'x86_64'
+ self.lr.arch = 'x86_32'
morph = self.mf.get_morphology('reponame', 'sha1', 'system.morph')
self.assertEqual(morph.builds_artifacts, ['system-rootfs'])
@@ -235,6 +235,17 @@ class MorphologyFactoryTests(unittest.TestCase):
morph = self.mf.get_morphology('reponame', 'sha1', 'system.morph')
self.assertEqual(morph.needs_artifact_metadata_cached, False)
+
+ def test_arch_is_validated(self):
+ self.lr.arch = 'unknown'
+ self.assertRaises(morphlib.Error, self.mf.get_morphology,
+ 'reponame', 'sha1', 'system.morph')
+
+ def test_arch_arm_defaults_to_le(self):
+ self.lr.arch = 'armv7'
+ morph = self.mf.get_morphology('reponame', 'sha1', 'system.morph')
+ self.assertEqual(morph['arch'], 'armv7l')
+
def test_fails_if_system_does_not_define_system_kind(self):
self.lr.system_kind = ''
self.assertRaises(morphlib.Error, self.mf.get_morphology,