summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-12-06 15:45:55 (GMT)
committerRichard Maw <richard.maw@codethink.co.uk>2014-01-16 17:35:06 (GMT)
commit9901b78e48fddeda2ed7f6dbf954abcde8fa9a0f (patch)
tree2110b58c6d68165748f793b943a5758c35ea830b
parent188fafc42db06161a1e1a39591b0d20cc083c5dc (diff)
downloadmorph-9901b78e48fddeda2ed7f6dbf954abcde8fa9a0f.tar.gz
yarns: Add tests for building systems with splitting
This includes tests for systems with the default splits and a system that selects only one of the produced stratum artifacts to go into the system artifact, since this is roughly the expected use-case for the tiny system morphologies.
-rw-r--r--yarns/implementations.yarn9
-rw-r--r--yarns/splitting.yarn129
2 files changed, 138 insertions, 0 deletions
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 083035f..5b9b39d 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -788,3 +788,12 @@ Implementations for building systems
IMPLEMENTS THEN morph build the system (\S+) of the (branch|tag) (\S+)
cd "$DATADIR/workspace/$MATCH_3"
run_morph build "$MATCH_1"
+
+Implementations for tarball inspection
+--------------------------------------
+
+ IMPLEMENTS THEN tarball (\S+) contains (.*)
+ tar -tf "$DATADIR/$MATCH_1" | grep -Fe "$MATCH_2"
+
+ IMPLEMENTS THEN tarball (\S+) doesn't contain (.*)
+ ! tar -tf "$DATADIR/$MATCH_1" | grep -Fe "$MATCH_2"
diff --git a/yarns/splitting.yarn b/yarns/splitting.yarn
new file mode 100644
index 0000000..e332419
--- /dev/null
+++ b/yarns/splitting.yarn
@@ -0,0 +1,129 @@
+Artifact splitting tests
+========================
+
+ SCENARIO building a system with morphologies that have splitting rules
+ GIVEN a workspace
+ AND a git server
+
+ AND chunk test-chunk includes the default splitting rules
+ AND stratum test-stratum includes the default splitting rules
+ AND system test-system includes the default splitting rules
+
+ WHEN the user checks out the system branch called master
+ THEN morph build the system test-system of the branch master
+
+
+
+ SCENARIO building a system only using runtime strata
+ GIVEN a workspace
+ AND a git server
+ AND system test-system only uses test-stratum-runtime from test-stratum
+ WHEN the user checks out the system branch called master
+ GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master
+ WHEN the user builds the system test-system in branch master
+ AND the user attempts to deploy the cluster test-cluster in branch master with options system.location="$DATADIR/test.tar"
+ THEN tarball test.tar contains bin/test
+ AND tarball test.tar contains lib/libtest.so
+ AND tarball test.tar doesn't contain lib/libtest.a
+ AND tarball test.tar doesn't contain man/man3/test.3.gz
+
+Implementations
+---------------
+
+ IMPLEMENTS GIVEN chunk (\S+) includes the default splitting rules
+ # Append default products rules
+ cat <<EOF >>"$DATADIR/gits/$MATCH_1/$MATCH_1.morph"
+ products:
+ - artifact: $MATCH_1-bins
+ include: [ "(usr/)?s?bin/.*" ]
+ - artifact: $MATCH_1-libs
+ include:
+ - (usr/)?lib(32|64)?/lib[^/]*\.so(\.\d+)*
+ - (usr/)?libexec/.*
+ - artifact: $MATCH_1-devel
+ include:
+ - (usr/)?include/.*
+ - (usr/)?lib(32|64)?/lib.*\.a
+ - (usr/)?lib(32|64)?/lib.*\.la
+ - (usr/)?(lib(32|64)?|share)/pkgconfig/.*\.pc
+ - artifact: $MATCH_1-doc
+ include:
+ - (usr/)?share/doc/.*
+ - (usr/)?share/man/.*
+ - (usr/)?share/info/.*
+ - artifact: $MATCH_1-locale
+ include:
+ - (usr/)?share/locale/.*
+ - (usr/)?share/i18n/.*
+ - (usr/)?share/zoneinfo/.*
+ - artifact: $MATCH_1-misc
+ include: [ .* ]
+ EOF
+ run_in "$DATADIR/gits/$MATCH_1" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/$MATCH_1" git commit -m 'Add default splitting rules'
+
+ IMPLEMENTS GIVEN stratum (\S+) includes the default splitting rules
+ # Append default products rules
+ cat <<EOF >"$DATADIR/gits/morphs/$MATCH_1.morph"
+ name: $MATCH_1
+ kind: stratum
+ products:
+ - artifact: $MATCH_1-devel
+ include:
+ - .*-devel
+ - .*-debug
+ - .*-doc
+ - artifact: $MATCH_1-runtime
+ include:
+ - .*-bins
+ - .*-libs
+ - .*-locale
+ - .*-misc
+ - .*
+ chunks:
+ - name: test-chunk
+ repo: test:test-chunk
+ ref: master
+ morph: test-chunk
+ build-mode: test
+ build-depends: []
+ artifacts:
+ test-chunk-bins: $MATCH_1-runtime
+ test-chunk-libs: $MATCH_1-runtime
+ test-chunk-locale: $MATCH_1-runtime
+ test-chunk-misc: $MATCH_1-runtime
+ test-chunk-devel: $MATCH_1-devel
+ test-chunk-doc: $MATCH_1-devel
+ EOF
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git commit -m 'Add default splitting rules'
+
+ IMPLEMENTS GIVEN system (\S+) includes the default splitting rules
+ cat << EOF > "$DATADIR/gits/morphs/$MATCH_1.morph"
+ name: $MATCH_1
+ kind: system
+ arch: $(run_morph print-architecture)
+ strata:
+ - name: test-stratum
+ repo: test:morphs
+ ref: master
+ morph: test-stratum
+ artifacts:
+ - test-stratum-runtime
+ - test-stratum-devel
+ EOF
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git commit -m 'Add default splitting rules'
+
+ IMPLEMENTS GIVEN system (\S+) only uses (\S+) from (\S+)
+ python -c 'import sys, yaml
+ with open(sys.argv[1], "r") as f:
+ d = yaml.load(f)
+ for spec in d["strata"]:
+ if spec["name"] == sys.argv[3]:
+ spec["artifacts"] = [sys.argv[2]]
+ with open(sys.argv[1], "w") as f:
+ yaml.dump(d, f)
+ ' "$DATADIR/gits/morphs/$MATCH_1.morph" "$MATCH_2" "$MATCH_3"
+ run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph"
+ run_in "$DATADIR/gits/morphs" git commit -m "Make $MATCH_1 only use $MATCH_2"