aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cfg-info.testscript176
-rw-r--r--tests/cfg-link.testscript36
-rw-r--r--tests/cfg-unlink.testscript6
3 files changed, 203 insertions, 15 deletions
diff --git a/tests/cfg-info.testscript b/tests/cfg-info.testscript
new file mode 100644
index 0000000..10e1e4c
--- /dev/null
+++ b/tests/cfg-info.testscript
@@ -0,0 +1,176 @@
+# file : tests/cfg-info.testscript
+# license : MIT; see accompanying LICENSE file
+
+.include common.testscript
+
+cfg_create += 2>!
+
+uuid1 = '18f48b4b-b5d9-4712-b98c-1930df1c4228'
+uuid2 = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
+uuid3 = '38f48b4b-b5d9-4712-b98c-1930df1c4228'
+uuid4 = '48f48b4b-b5d9-4712-b98c-1930df1c4228'
+
++$cfg_create -d cfg1 --name 't1' --uuid "$uuid1" &cfg1/***
++$cfg_create -d cfg2 --name 't2' --uuid "$uuid2" &cfg2/***
++$cfg_create -d cfg3 --name 'h3' --uuid "$uuid3" --type host &cfg3/***
++$cfg_create -d cfg4 --name 'b4' --uuid "$uuid4" --type build2 &cfg4/***
+
++$cfg_link -d cfg1 cfg3 2>!
++$cfg_link -d cfg2 cfg3 2>!
++$cfg_link -d cfg3 cfg4 2>!
+
+clone_cfgs = cp -r ../cfg1 ../cfg2 ../cfg3 ../cfg4 ./
+
+sp = ' '
+
+: self
+:
+{
+ $clone_cfgs;
+
+ $* -d cfg1 >>/"EOO"
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+ EOO
+}
+
+: links
+:
+{
+ $clone_cfgs;
+
+ $* -d cfg1 --link >>/"EOO"
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+ EOO
+}
+
+: links-recursive
+:
+{
+ $clone_cfgs;
+
+ $* -d cfg1 --link --recursive >>/"EOO"
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+
+ path: $~/cfg4/
+ uuid: $uuid4
+ type: build2
+ name: b4
+ EOO
+}
+
+: backlinks
+:
+{
+ $clone_cfgs;
+
+ $* -d cfg3 --backlink >>/"EOO";
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+
+ path: $~/cfg2/
+ uuid: $uuid2
+ type: target
+ name: t2
+ EOO
+
+ mv cfg2 cfg2.tmp;
+
+ # Make sure that dangling links are silently skipped.
+ #
+ $* -d cfg3 --backlink >>/"EOO";
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+ EOO
+
+ # While at it, test printing dangling links.
+ #
+ $* -d cfg3 --dangling >>/"EOO";
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+
+ path: $~/cfg2/
+ uuid: $uuid2
+ type: target
+ name:$sp
+ EOO
+
+ $* -d cfg3 --dangling --backlink >>/"EOO"
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+
+ path: $~/cfg2/
+ uuid: $uuid2
+ type: target
+ name:$sp
+ EOO
+}
+
+: all-links-recursive
+:
+{
+ $clone_cfgs;
+
+ $* -d cfg1 --link --backlink --recursive >>/"EOO"
+ path: $~/cfg1/
+ uuid: $uuid1
+ type: target
+ name: t1
+
+ path: $~/cfg3/
+ uuid: $uuid3
+ type: host
+ name: h3
+
+ path: $~/cfg2/
+ uuid: $uuid2
+ type: target
+ name: t2
+
+ path: $~/cfg4/
+ uuid: $uuid4
+ type: build2
+ name: b4
+ EOO
+}
diff --git a/tests/cfg-link.testscript b/tests/cfg-link.testscript
index 26496eb..091d2f0 100644
--- a/tests/cfg-link.testscript
+++ b/tests/cfg-link.testscript
@@ -17,7 +17,7 @@ acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
$cfg_create -d cfg --name 'main';
$cfg_create -d acfg --name 'shared' --uuid "$acfg_uuid" &acfg/***;
- # Try to link configuration under the same name.
+ # Try to link self configuration.
#
$* cfg 2>>/~"%EOE%" != 0;
%error: linking configuration .+/cfg/ with itself%
@@ -53,8 +53,11 @@ acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
name: shared
EOO
- $pkg_status -d cfg libfoo >'libfoo unknown';
- $pkg_status -d acfg libfoo >'libfoo unknown';
+ $cfg_info -d cfg2 --backlink >>/"EOO";
+ path: $~/cfg2/
+ uuid: $uuid2
+ type: target
+ name: shared
# Test that the recreated configuration can be implicitly re-linked.
#
@@ -76,9 +79,17 @@ acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
%error: configuration with uuid .{36} is already linked as \.\./acfg/%
EOE
- rm -r acfg;
+ # Test that the integrity check fails.
+ #
+ mv acfg acfg.tmp;
- $cfg_create -d acfg --name 'shared' &acfg/***;
+ $cfg_create -d acfg --name 'shared';
+
+ $pkg_status -d cfg libfoo 2>>/~"%EOE%" != 0;
+ error: configuration acfg/ uuid mismatch
+ % info: uuid .+%
+ info: linked with cfg/ as $acfg_uuid
+ EOE
# Test that the path clash is reported.
#
@@ -95,6 +106,8 @@ acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
info: consider specifying alternative name with --name
EOE
+ # Link the second configuration.
+ #
$* acfg2 2>>/~%EOE%;
warning: configuration with name shared is already linked as ../acfg/, linking as unnamed
%linked with configuration .+/acfg2/%
@@ -103,18 +116,17 @@ acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
id: 2
EOE
- # Test that the integrity check fails.
+ # Restore the integrity.
#
- $pkg_status -d cfg libfoo 2>>/~"%EOE%" != 0;
+
+ $cfg_info -d cfg >- 2>>/~%EOE% != 0;
error: configuration acfg/ uuid mismatch
- % info: uuid .+%
- info: linked with cfg/ as $acfg_uuid
+ % info: uuid .{36}%
+ % info: linked with cfg/ as .{36}%
EOE
- # Link the second configuration.
- #
rm -r acfg;
- $cfg_create -d acfg --name 'shared' --uuid "$acfg_uuid" &acfg/***;
+ mv acfg.tmp acfg;
$cfg_info -d cfg >>/~"%EOO%";
path: $~/cfg/
diff --git a/tests/cfg-unlink.testscript b/tests/cfg-unlink.testscript
index b65f4b1..2ca3783 100644
--- a/tests/cfg-unlink.testscript
+++ b/tests/cfg-unlink.testscript
@@ -148,7 +148,7 @@ clone_root_cfgs = cp -r $~/cfg1 $~/cfg2 ./
$cfg_link -d cfg2 cfg1 2>!;
$* -d cfg1 cfg2 2>>/"EOE";
- info: configurations cfg2/ and cfg1/ are mutually linked, turning the link to cfg2/ into implicit back-link
+ info: configurations cfg2/ and cfg1/ are mutually linked, turning the link to cfg2/ into implicit backlink
unlinked configuration $~/cfg2/
EOE
@@ -261,8 +261,8 @@ clone_root_cfgs = cp -r $~/cfg1 $~/cfg2 ./
mv cfg1 cfg3;
- $* -d cfg2 --dangling 2>'removed 1 dangling implicit back-link(s)';
- $* -d cfg2 --dangling 2>'removed 0 dangling implicit back-link(s)'
+ $* -d cfg2 --dangling 2>'removed 1 dangling implicit backlink(s)';
+ $* -d cfg2 --dangling 2>'removed 0 dangling implicit backlink(s)'
}
: error