diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-09-07 23:00:39 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-09-07 23:00:39 +0200 |
| commit | 9b6c4355645534d1ae799bfef6761b75ed8b3a41 (patch) | |
| tree | 7d36556a55c5daded689ef86e33b3b31a2763070 /tests/services.scm | |
| parent | 9f1f200c0462d5fa798e4d7b8c3c09294f8bfb95 (diff) | |
services: 'instantiate-missing-services' reaches fixed point.
Fixes a bug whereby services indirectly depended on would not be
automatically instantiated.
* gnu/services.scm (instantiate-missing-services): Loop back when the
length of ADJUSTED is greater than that of INSTANCES.
* tests/services.scm ("instantiate-missing-services, indirect"): New test.
Diffstat (limited to 'tests/services.scm')
| -rw-r--r-- | tests/services.scm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/services.scm b/tests/services.scm index b146a0dec2a..1ad577e6015 100644 --- a/tests/services.scm +++ b/tests/services.scm | |||
| @@ -138,6 +138,31 @@ | |||
| 138 | (equal? (list s1 s2) | 138 | (equal? (list s1 s2) |
| 139 | (instantiate-missing-services (list s1 s2)))))) | 139 | (instantiate-missing-services (list s1 s2)))))) |
| 140 | 140 | ||
| 141 | (test-assert "instantiate-missing-services, indirect" | ||
| 142 | (let* ((t1 (service-type (name 't1) (extensions '()) | ||
| 143 | (default-value 'dflt) | ||
| 144 | (compose concatenate) | ||
| 145 | (extend cons))) | ||
| 146 | (t2 (service-type (name 't2) (extensions '()) | ||
| 147 | (default-value 'dflt2) | ||
| 148 | (compose concatenate) | ||
| 149 | (extend cons) | ||
| 150 | (extensions | ||
| 151 | (list (service-extension t1 list))))) | ||
| 152 | (t3 (service-type (name 't3) | ||
| 153 | (extensions | ||
| 154 | (list (service-extension t2 list))))) | ||
| 155 | (s1 (service t1)) | ||
| 156 | (s2 (service t2)) | ||
| 157 | (s3 (service t3 42)) | ||
| 158 | (== (cut lset= equal? <...>))) | ||
| 159 | (and (== (list s1 s2 s3) | ||
| 160 | (instantiate-missing-services (list s3))) | ||
| 161 | (== (list s1 s2 s3) | ||
| 162 | (instantiate-missing-services (list s1 s3))) | ||
| 163 | (== (list s1 s2 s3) | ||
| 164 | (instantiate-missing-services (list s2 s3)))))) | ||
| 165 | |||
| 141 | (test-assert "instantiate-missing-services, no default value" | 166 | (test-assert "instantiate-missing-services, no default value" |
| 142 | (let* ((t1 (service-type (name 't1) (extensions '()))) | 167 | (let* ((t1 (service-type (name 't1) (extensions '()))) |
| 143 | (t2 (service-type (name 't2) | 168 | (t2 (service-type (name 't2) |
