+ /* Initialize dependency lists. */
+ foreach_ptr(list, &compulsory_tests, &normal_tests) {
+ list_for_each(list, c, list) {
+ list_head_init(&c->dependencies);
+ }
+ }
+
+ /* Resolve dependencies. */
+ foreach_ptr(list, &compulsory_tests, &normal_tests) {
+ list_for_each(list, c, list) {
+ char **deps = strsplit(NULL, c->needs, " ", NULL);
+ unsigned int i;
+
+ for (i = 0; deps[i]; i++) {
+ struct ccanlint *dep;
+ struct dependent *dchild;
+
+ dep = find_test(deps[i]);
+ if (!dep)
+ errx(1, "BUG: unknown dep '%s' for %s",
+ deps[i], c->key);
+ dchild = talloc(NULL, struct dependent);
+ dchild->dependent = c;
+ list_add_tail(&dep->dependencies,
+ &dchild->node);
+ c->num_depends++;
+ }
+ talloc_free(deps);
+ }
+ }
+