aboutsummaryrefslogtreecommitdiff
path: root/tests/cfg-info.testscript
blob: 10e1e4c2992c8c7680ba4789f58b0ace2e20f748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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
}