diff options
-rw-r--r-- | morphlib/morph2_tests.py | 2 | ||||
-rw-r--r-- | morphlib/morphologyfactory.py | 11 | ||||
-rw-r--r-- | morphlib/morphologyfactory_tests.py | 8 | ||||
-rwxr-xr-x | tests.as-root/disk-builds-rootfs-and-kernel.script | 55 | ||||
-rw-r--r-- | tests.as-root/disk-builds-rootfs-and-kernel.stdout | 43 | ||||
-rwxr-xr-x | tests.as-root/syslinux-disk-builds-rootfs-and-kernel.script | 57 | ||||
-rw-r--r-- | tests.as-root/syslinux-disk-builds-rootfs-and-kernel.stdout | 44 | ||||
-rw-r--r-- | tests.as-root/syslinux-fails-if-no-mbr-found.exit | 1 | ||||
-rwxr-xr-x | tests.as-root/syslinux-fails-if-no-mbr-found.script | 33 | ||||
-rw-r--r-- | tests.as-root/syslinux-fails-if-no-mbr-found.stderr | 1 | ||||
-rw-r--r-- | tests.as-root/target-disk-too-small.exit | 1 | ||||
-rwxr-xr-x | tests.as-root/target-disk-too-small.script | 51 | ||||
-rw-r--r-- | tests.as-root/target-disk-too-small.stderr | 1 |
13 files changed, 19 insertions, 289 deletions
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index 49be9c8c..1a0b4822 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -309,7 +309,7 @@ class MorphologyTests(unittest.TestCase): "kind": "system", "disk-size": "1g", "arch": "x86_64", - "system-kind": "syslinux-disk" + "system-kind": "rootfs-tarball" }''' def test_writing_preserves_disk_size(self): diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py index 76905eb9..817d7fcd 100644 --- a/morphlib/morphologyfactory.py +++ b/morphlib/morphologyfactory.py @@ -110,6 +110,17 @@ class MorphologyFactory(object): raise morphlib.Error('No system-kind defined in system %s ' '(it is a mandatory field)' % filename) + if morphology['system-kind'] != 'rootfs-tarball': + self._app.status( + msg='You are using a system-kind %(kind)s. ' + 'This is deprecated and untested functionality that will ' + 'be removed in a future version of Baserock. The only ' + 'supported system-kind is rootfs-tarball. ' + 'Please convert your system morphologies to ' + 'rootfs-tarball and use morph deploy to create ' + 'disk images.', + kind=morphology['system-kind']) + name = morphology['name'] morphology.builds_artifacts = [name + '-rootfs'] diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py index 6e17df48..dbdb4228 100644 --- a/morphlib/morphologyfactory_tests.py +++ b/morphlib/morphologyfactory_tests.py @@ -106,13 +106,19 @@ class FakeLocalRepoCache(object): return self.lr +class FakeApp(object): + + def status(self, **kwargs): + pass + + class MorphologyFactoryTests(unittest.TestCase): def setUp(self): self.lr = FakeLocalRepo() self.lrc = FakeLocalRepoCache(self.lr) self.rrc = FakeRemoteRepoCache() - self.mf = MorphologyFactory(self.lrc, self.rrc) + self.mf = MorphologyFactory(self.lrc, self.rrc, app=FakeApp()) self.lmf = MorphologyFactory(self.lrc, None) def nolocalfile(self, *args): diff --git a/tests.as-root/disk-builds-rootfs-and-kernel.script b/tests.as-root/disk-builds-rootfs-and-kernel.script deleted file mode 100755 index 2eb57743..00000000 --- a/tests.as-root/disk-builds-rootfs-and-kernel.script +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## A system kind of 'disk' should create the disk image, plus a kernel file. - -set -eu - -. "$SRCDIR/tests.as-root/lib" - -cache="$DATADIR/cache/artifacts" - -cd "$DATADIR/morphs" -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" - -rootfs=$("$SRCDIR/scripts/test-morph" --find-system-artifact \ - build-morphology test:morphs master linux-system) - -for suffix in kernel rootfs -do - if [ ! -e "$cache"/*system.linux-system-"$suffix" ]; - then - echo "No .system.linux-system-$suffix" 1>&2 - find "$cache" 1>&2 - exit 1 - fi -done - -mkdir -p "$DATADIR/mnt" -device=$(loopback_rootfs "$rootfs") -mount "$device" "$DATADIR/mnt" -trap 'cd /; umount -d "$device"' INT TERM ERR - -cd "$DATADIR/mnt" -find | LC_ALL=C sort -u -sed -e 's/ on [0-9\-]\+//' "$DATADIR/mnt/factory-run/etc/os-release" -cd "$DATADIR" -umount -d "$device" diff --git a/tests.as-root/disk-builds-rootfs-and-kernel.stdout b/tests.as-root/disk-builds-rootfs-and-kernel.stdout deleted file mode 100644 index 4e8a67ae..00000000 --- a/tests.as-root/disk-builds-rootfs-and-kernel.stdout +++ /dev/null @@ -1,43 +0,0 @@ -. -./boot -./boot/System.map -./boot/vmlinuz -./factory -./factory-run -./factory-run/baserock -./factory-run/baserock/hello-stratum.meta -./factory-run/baserock/hello.meta -./factory-run/baserock/linux-stratum.meta -./factory-run/baserock/linux-system-rootfs.meta -./factory-run/baserock/linux.meta -./factory-run/baserock/tools-stratum.meta -./factory-run/baserock/tools.meta -./factory-run/bin -./factory-run/bin/hello -./factory-run/bin/strace -./factory-run/boot -./factory-run/boot/System.map -./factory-run/boot/vmlinuz -./factory-run/etc -./factory-run/etc/fstab -./factory-run/etc/os-release -./factory-run/extlinux.conf -./factory/baserock -./factory/baserock/hello-stratum.meta -./factory/baserock/hello.meta -./factory/baserock/linux-stratum.meta -./factory/baserock/linux-system-rootfs.meta -./factory/baserock/linux.meta -./factory/baserock/tools-stratum.meta -./factory/baserock/tools.meta -./factory/bin -./factory/bin/hello -./factory/bin/strace -./factory/boot -./factory/boot/System.map -./factory/boot/vmlinuz -./factory/etc -./factory/etc/fstab -./factory/etc/os-release -./factory/extlinux.conf -Baserock linux-system, built from ref master diff --git a/tests.as-root/syslinux-disk-builds-rootfs-and-kernel.script b/tests.as-root/syslinux-disk-builds-rootfs-and-kernel.script deleted file mode 100755 index cfadc452..00000000 --- a/tests.as-root/syslinux-disk-builds-rootfs-and-kernel.script +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2011, 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## A system kind of syslinux-disk should create the disk image, plus a kernel -## file. - -set -eu - -. "$SRCDIR/tests.as-root/lib" - -# We only support x86 systems with syslinux-disk. -arch=$(uname -m) -case "$arch" in - x86*) ;; - *) exit 0 ;; -esac - -cache="$DATADIR/cache/artifacts" - -rootfs=$("$SRCDIR/scripts/test-morph" --find-system-artifact \ - build-morphology test:morphs master linux-system) - -for suffix in kernel rootfs -do - if [ ! -e "$cache"/*system.linux-system-"$suffix" ]; - then - echo "No .system.linux-system-$suffix" 1>&2 - find "$cache" 1>&2 - exit 1 - fi -done - -mkdir -p "$DATADIR/mnt" -device=$(loopback_rootfs "$rootfs") -mount "$device" "$DATADIR/mnt" -trap 'cd /; umount -d "$device"' INT TERM ERR - -cd "$DATADIR/mnt" -find | LC_ALL=C sort -u -sed -e 's/ on [0-9\-]\+//' "$DATADIR/mnt/factory-run/etc/os-release" -cd "$DATADIR" -umount -d "$device" diff --git a/tests.as-root/syslinux-disk-builds-rootfs-and-kernel.stdout b/tests.as-root/syslinux-disk-builds-rootfs-and-kernel.stdout deleted file mode 100644 index ecc10ba6..00000000 --- a/tests.as-root/syslinux-disk-builds-rootfs-and-kernel.stdout +++ /dev/null @@ -1,44 +0,0 @@ -. -./boot -./boot/System.map -./boot/vmlinuz -./extlinux.conf -./factory -./factory-run -./factory-run/baserock -./factory-run/baserock/hello-stratum.meta -./factory-run/baserock/hello.meta -./factory-run/baserock/linux-stratum.meta -./factory-run/baserock/linux-system-rootfs.meta -./factory-run/baserock/linux.meta -./factory-run/baserock/tools-stratum.meta -./factory-run/baserock/tools.meta -./factory-run/bin -./factory-run/bin/hello -./factory-run/bin/strace -./factory-run/boot -./factory-run/boot/System.map -./factory-run/boot/vmlinuz -./factory-run/etc -./factory-run/etc/fstab -./factory-run/etc/os-release -./factory-run/extlinux.conf -./factory/baserock -./factory/baserock/hello-stratum.meta -./factory/baserock/hello.meta -./factory/baserock/linux-stratum.meta -./factory/baserock/linux-system-rootfs.meta -./factory/baserock/linux.meta -./factory/baserock/tools-stratum.meta -./factory/baserock/tools.meta -./factory/bin -./factory/bin/hello -./factory/bin/strace -./factory/boot -./factory/boot/System.map -./factory/boot/vmlinuz -./factory/etc -./factory/etc/fstab -./factory/etc/os-release -./factory/extlinux.conf -Baserock linux-system, built from ref master diff --git a/tests.as-root/syslinux-fails-if-no-mbr-found.exit b/tests.as-root/syslinux-fails-if-no-mbr-found.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.as-root/syslinux-fails-if-no-mbr-found.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.as-root/syslinux-fails-if-no-mbr-found.script b/tests.as-root/syslinux-fails-if-no-mbr-found.script deleted file mode 100755 index b0d5b9bd..00000000 --- a/tests.as-root/syslinux-fails-if-no-mbr-found.script +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2011, 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -# Handle invalid syslinux MBR parameters. - -set -eu - -# We only support x86 systems with syslinux-disk. -arch=$(uname -m) -case "$arch" in - x86*) ;; - *) exit 0 ;; -esac - -cache="$DATADIR/cache/artifacts" - -"$SRCDIR/scripts/test-morph" --syslinux-mbr-search-path=nosuchfile.bin \ - build-morphology test:morphs master linux-system > /dev/null diff --git a/tests.as-root/syslinux-fails-if-no-mbr-found.stderr b/tests.as-root/syslinux-fails-if-no-mbr-found.stderr deleted file mode 100644 index e9bfd741..00000000 --- a/tests.as-root/syslinux-fails-if-no-mbr-found.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: No syslinux mbr found in search paths: ['nosuchfile.bin'] diff --git a/tests.as-root/target-disk-too-small.exit b/tests.as-root/target-disk-too-small.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.as-root/target-disk-too-small.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.as-root/target-disk-too-small.script b/tests.as-root/target-disk-too-small.script deleted file mode 100755 index ff3a374f..00000000 --- a/tests.as-root/target-disk-too-small.script +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Handle target disk image being too small for its contents. - -set -eu - -. "$SRCDIR/tests.as-root/lib" - -# 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/' \ - -i linux-system.morph -git add linux-system.morph -git commit -q -m "Make linux-system as small as possible" - -# Grow hello-chunk to be absurdly large. -cd "$DATADIR/chunk-repo" -git checkout -q farrokh -cat <<'EOF' > hello.morph -{ - "name": "hello", - "kind": "chunk", - "build-system": "dummy", - "install-commands": [ - "dd if=/dev/zero of=\"$DESTDIR\"/huge-file seek=1048580 count=0" - ] -} -EOF -git add hello.morph -git commit -q -m "Make hello be very big" - -# Ignore stdout - Morph logs a timestamped error -"$SRCDIR/scripts/test-morph" build-morphology test:morphs master linux-system \ - > /dev/null diff --git a/tests.as-root/target-disk-too-small.stderr b/tests.as-root/target-disk-too-small.stderr deleted file mode 100644 index 487c72e2..00000000 --- a/tests.as-root/target-disk-too-small.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: Ran out of space on linux-system-rootfs disk image. Please increase the system's disk-size. |