diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-23 16:57:21 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-23 17:01:25 +0000 |
commit | 7a7eb63c7764851176a63a8a391e2de7386886ad (patch) | |
tree | 2a8c0846c0900f89d1350c6ce18c16759adb2da4 /tests | |
parent | 9f43081691feb516063b21486f40a52a7988ee36 (diff) | |
download | morph-7a7eb63c7764851176a63a8a391e2de7386886ad.tar.gz |
tests: add test for patch building
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/make-patch.script | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/make-patch.script b/tests/make-patch.script new file mode 100755 index 00000000..9b50ea96 --- /dev/null +++ b/tests/make-patch.script @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Test making a patch between two different system images +# +# Copyright (C) 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. + +set -eu + +tests/morph build morphs-repo master hello-system.morph + +# save the stratum as we will apply the patch on top of this later +cp "$DATADIR/cache/"*stratum* "$DATADIR"/farrokh-stratum + + +( # make an evil stratum + cd "$DATADIR/chunk-repo" + git checkout --quiet -b evil farrokh + sed -i -e 's/hello/goodbye/g' hello.c + git add hello.c + git commit --quiet -m "Make the program evil" + + cd "$DATADIR/morphs-repo" + git checkout --quiet -b evil master + sed -i -e 's/farrokh/evil/g' hello-stratum.morph + git add hello-stratum.morph + git commit --quiet -m "Build evil systems" +) + +tests/morph build morphs-repo evil hello-system.morph + +# make a patch to make the system evil +PATCH="$DATADIR"/patchfile +tests/morph make_patch "$PATCH" morphs-repo master hello-system.morph \ + morphs-repo evil hello-system.morph + +UNPACKED="$DATADIR"/unpacked +mkdir -p "$UNPACKED" +tar -C "$UNPACKED" -xf "$DATADIR"/farrokh-stratum +(cd "$UNPACKED" && tbdiff-deploy "$PATCH") +"$UNPACKED"/hello |