[PATCH 4/5] Change build tests to use YAML morphologies

Javier Jardón javier.jardon at codethink.co.uk
Mon Jan 28 15:59:13 GMT 2013


---
 tests.as-root/disk-builds-rootfs-and-kernel.script |   4 +-
 .../rootfs-tarball-builds-rootfs-and-kernel.script |   2 +-
 tests.as-root/setup                                | 144 ++++++++-------------
 tests.as-root/tarball-image-is-sensible.setup      |   4 +-
 tests.as-root/target-disk-too-small.script         |   6 +-
 5 files changed, 64 insertions(+), 96 deletions(-)

diff --git a/tests.as-root/disk-builds-rootfs-and-kernel.script b/tests.as-root/disk-builds-rootfs-and-kernel.script
index c11c246..2eb5774 100755
--- a/tests.as-root/disk-builds-rootfs-and-kernel.script
+++ b/tests.as-root/disk-builds-rootfs-and-kernel.script
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (C) 2012  Codethink Limited
+# Copyright (C) 2012,2013  Codethink Limited
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ set -eu
 cache="$DATADIR/cache/artifacts"
 
 cd "$DATADIR/morphs"
-sed -e 's/"system-kind": "syslinux-disk"/"system-kind": "disk"/' \
+sed -e 's/system-kind: syslinux-disk/system-kind: disk/' \
     -i linux-system.morph
 git add linux-system.morph
 git commit --quiet -m "Build rootfs tarball system"
diff --git a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
index c6179aa..856d348 100755
--- a/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
+++ b/tests.as-root/rootfs-tarball-builds-rootfs-and-kernel.script
@@ -29,7 +29,7 @@ cache="$DATADIR/cache/artifacts"
 arch=$(uname -m)
 
 cd "$DATADIR/morphs"
-sed -e 's/"system-kind": "syslinux-disk"/"system-kind": "rootfs-tarball"/' \
+sed -e 's/system-kind: syslinux-disk/system-kind: rootfs-tarball/' \
     -i linux-system.morph
 git add linux-system.morph
 git commit --quiet -m "Build rootfs tarball system"
diff --git a/tests.as-root/setup b/tests.as-root/setup
index d3ba7ef..285a314 100755
--- a/tests.as-root/setup
+++ b/tests.as-root/setup
@@ -10,7 +10,7 @@
 # The stratum repository contains a single branch, "master", with a
 # stratum and a system morphology that include the chunk above.
 #
-# Copyright (C) 2011, 2012  Codethink Limited
+# Copyright (C) 2011, 2012, 2013  Codethink Limited
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -62,19 +62,15 @@ EOF
 git add hello.c
 
 cat <<EOF > hello.morph
-{
-    "name": "hello",
-    "kind": "chunk",
-    "build-system": "dummy",
-    "build-commands": [
-        "gcc -o hello hello.c"
-    ],
-    "install-commands": [
-        "install -d \\"\$DESTDIR\\"/etc",
-        "install -d \\"\$DESTDIR\\"/bin",
-        "install hello \\"\$DESTDIR\\"/bin/hello"
-    ]
-}
+name: hello
+kind: chunk
+build-system: dummy
+build-commands:
+    - gcc -o hello hello.c
+install-commands:
+    - install -d "\$DESTDIR"/etc
+    - install -d "\$DESTDIR"/bin
+    - install hello "\$DESTDIR"/bin/hello
 EOF
 git add hello.morph
 
@@ -92,82 +88,57 @@ cd "$morphsrepo"
 git init --quiet
 
 cat <<EOF > hello-stratum.morph
-{
-    "name": "hello-stratum",
-    "kind": "stratum",
-    "chunks": [
-        {
-            "name": "hello",
-            "repo": "test:chunk-repo",
-            "ref": "farrokh",
-            "build-depends": []
-        }
-    ]
-}
+name: hello-stratum
+kind: stratum
+chunks:
+    - name: hello
+      repo: test:chunk-repo
+      ref: farrokh
+      build-depends: []
 EOF
 git add hello-stratum.morph
 
 cat <<EOF > hello-system.morph
-{
-    "name": "hello-system",
-    "kind": "system",
-    "system-kind": "syslinux-disk",
-    "arch": "$(uname -m)",
-    "disk-size": "1G",
-    "strata": [
-        {
-            "morph": "hello-stratum",
-            "repo": "test:morphs",
-            "ref": "master"
-        }
-    ]
-}
+name: hello-system
+kind: system
+system-kind: syslinux-disk
+arch: `uname -m`
+disk-size: 1G
+strata:
+    - morph: hello-stratum
+      repo: test:morphs
+      ref: master
 EOF
 git add hello-system.morph
 
 cat <<EOF > linux-stratum.morph
-{
-    "name": "linux-stratum",
-    "kind": "stratum",
-    "build-depends": [
-        {
-            "morph": "hello-stratum",
-            "repo": "test:morphs",
-            "ref": "master"
-        }
-    ],
-    "chunks": [
-        {
-            "name": "linux",
-            "repo": "test:kernel-repo",
-            "ref": "master",
-            "build-depends": []
-        }
-    ]
-}
+name: linux-stratum
+kind: stratum
+build-depends:
+    - morph: hello-stratum
+      repo: test:morphs
+      ref: master
+chunks:
+    - name: linux
+      repo: test:kernel-repo
+      ref: master
+      build-depends: []
 EOF
 git add linux-stratum.morph
 
 cat <<EOF > linux-system.morph
-{
-    "name": "linux-system",
-    "kind": "system",
-    "system-kind": "syslinux-disk",
-    "arch": "$(uname -m)",
-    "disk-size": "1G",
-    "strata": [
-        {
-            "morph": "hello-stratum",
-            "repo": "test:morphs",
-            "ref": "master"
-        },
-        {
-            "morph": "linux-stratum",
-            "repo": "test:morphs",
-            "ref": "master"
-        }
-    ]
-}
+name: linux-system
+kind: system
+system-kind: syslinux-disk
+arch: `uname -m`
+disk-size: 1G
+strata:
+    - morph: hello-stratum
+      repo: test:morphs
+      ref: master
+    - morph: linux-stratum
+      repo: test:morphs
+      ref: master
 EOF
 git add linux-system.morph
 
@@ -176,16 +147,13 @@ git commit --quiet -m "add morphs"
 # Make a dummy kernel chunk.
 mkdir "$DATADIR/kernel-repo"
 cat <<EOF > "$DATADIR/kernel-repo/linux.morph"
-{
-    "name": "linux",
-    "kind": "chunk",
-    "install-commands": [
-        "mkdir -p \"\$DESTDIR/boot\"",
-        "touch \"\$DESTDIR\"/extlinux.conf",
-        "touch \"\$DESTDIR\"/boot/vmlinuz",
-        "touch \"\$DESTDIR\"/boot/System.map"
-    ]
-}
+name: linux
+kind: chunk
+install-commands:
+    - mkdir -p "\$DESTDIR/boot"
+    - touch "\$DESTDIR/extlinux.conf"
+    - touch "\$DESTDIR/boot/vmlinuz"
+    - touch "\$DESTDIR/boot/System.map"
 EOF
 "$SRCDIR/scripts/run-git-in" "$DATADIR/kernel-repo" init --quiet
 "$SRCDIR/scripts/run-git-in" "$DATADIR/kernel-repo" add .
diff --git a/tests.as-root/tarball-image-is-sensible.setup b/tests.as-root/tarball-image-is-sensible.setup
index c1c8899..e159070 100755
--- a/tests.as-root/tarball-image-is-sensible.setup
+++ b/tests.as-root/tarball-image-is-sensible.setup
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (C) 2011, 2012  Codethink Limited
+# Copyright (C) 2011-2013  Codethink Limited
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -71,7 +71,7 @@ git add hello-tarball.morph
 
 # Change build-depends ref of hello-stratum from master to tarball-links
 sed -i linux-stratum.morph \
-    -e '/"build-depends": \[/,/\]/ s/"ref": "master"/"ref": "tarball-links"/'
+    -e '/build-depends:/,/chunks/ s/ref: master/ref: tarball-links/'
 
 git add linux-stratum.morph
 
diff --git a/tests.as-root/target-disk-too-small.script b/tests.as-root/target-disk-too-small.script
index 92a73a5..ff3a374 100755
--- a/tests.as-root/target-disk-too-small.script
+++ b/tests.as-root/target-disk-too-small.script
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (C) 2011, 2012  Codethink Limited
+# Copyright (C) 2011-2013  Codethink Limited
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,8 +24,8 @@ set -eu
 
 # Shrink linux-system to the minimum btrfs will allow.
 cd "$DATADIR/morphs"
-sed -e 's/"system-kind": "syslinux-disk"/"system-kind": "disk"/' \
-    -e 's/"disk-size": "1G"/"disk-size": "512M"/' \
+sed -e 's/system-kind: syslinux-disk/system-kind: disk/' \
+    -e 's/disk-size: 1G/disk-size: 512M/' \
     -i linux-system.morph
 git add linux-system.morph
 git commit -q -m "Make linux-system as small as possible"
-- 
1.8.1





More information about the baserock-dev mailing list