summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-12-12 17:06:39 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-12-12 17:06:39 +0000
commit9dbb2496767be6af8388168dc211d435b4191bd2 (patch)
tree45a53d18fe0b97c97a7129ddcf7c6568bbf9c169
parent410c58c37931f17fd68c1a6fafa192b56ae3e978 (diff)
downloadmorph-9dbb2496767be6af8388168dc211d435b4191bd2.tar.gz
make a test subcommand that builds and gets the morph, image filename
-rwxr-xr-xmorph15
-rw-r--r--morphlib/builder.py4
2 files changed, 16 insertions, 3 deletions
diff --git a/morph b/morph
index cbee2305..2c4d5031 100755
--- a/morph
+++ b/morph
@@ -82,11 +82,12 @@ class Morph(cliapp.Application):
if not os.path.exists(self.settings['cachedir']) and os.getuid() != 0:
os.mkdir(self.settings['cachedir'])
+ ret = []
while len(args) >= 3:
repo, ref, filename = args[:3]
args = args[3:]
self.msg('Building %s - %s - %s' % (repo, ref, filename))
- builder.build(repo, ref, filename)
+ ret.append(builder.build(repo, ref, filename))
# we may not have permission to tempdir.remove()
ex = morphlib.execute.Execute('.', lambda msg: None)
@@ -94,6 +95,8 @@ class Morph(cliapp.Application):
if args:
raise cliapp.AppException('Extra args on command line: %s' % args)
+
+ return ret
def cmd_testsysimg(self, args):
'''Run tests for a built system image.
@@ -126,6 +129,16 @@ class Morph(cliapp.Application):
story.run()
self.msg('Finished OK.')
+ def cmd_test(self, args):
+ '''Build and test a system morphology.
+
+ The tests are specified in the morphology's test-stories field.
+
+ '''
+
+ for x in self.cmd_build(args):
+ print x
+
def msg(self, msg):
'''Show a message to the user about what is going on.'''
logging.debug(msg)
diff --git a/morphlib/builder.py b/morphlib/builder.py
index d1ef7c32..8e3742f4 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -532,13 +532,13 @@ class Builder(object):
self.indent_less()
self.dump_memory_profile('at end of build method')
- return built
+ return morph, built
def build_needed(self, blob):
blob.built = []
for repo, ref, morph_name, blob_names in blob.needs_built():
morph_filename = '%s.morph' % morph_name
- cached = self.build(repo, ref, morph_filename)
+ morph, cached = self.build(repo, ref, morph_filename)
for blob_name in blob_names:
blob.built.append((blob_name, cached[blob_name]))