1 when the database does not hold what `w` asks for (and says what it * holds instead), else 0. */
| 6570 | /* 1 when the database does not hold what `w` asks for (and says what it |
| 6571 | * holds instead), else 0. */ |
| 6572 | static int dm_want_failed(const char *db, const dm_want_t *w) { |
| 6573 | char props[512]; |
| 6574 | char reason[64]; |
| 6575 | int n = 0; |
| 6576 | int bad = 0; |
| 6577 | dm_row(db, w->rel, w->raw, reason, sizeof(reason), NULL, 0); |
| 6578 | if (strcmp(reason, w->reason ? w->reason : "") != 0) { |
| 6579 | printf(" `%s` in %s: row [%s], want [%s]\n", w->raw, w->rel, reason, |
| 6580 | w->reason ? w->reason : ""); |
| 6581 | bad = 1; |
| 6582 | } |
| 6583 | if (w->target) { |
| 6584 | dm_edge(db, w->src, w->target, props, sizeof(props), &n); |
| 6585 | if (n != 1) { |
| 6586 | printf(" `%s` in %s: %d edges %s -> %s, want 1\n", w->raw, w->rel, n, w->src, |
| 6587 | w->target); |
| 6588 | bad = 1; |
| 6589 | } else if (w->tier && !strstr(props, w->tier)) { |
| 6590 | printf(" `%s` in %s: edge %s, want %s\n", w->raw, w->rel, props, w->tier); |
| 6591 | bad = 1; |
| 6592 | } |
| 6593 | } |
| 6594 | if (w->never) { |
| 6595 | dm_edge(db, w->src, w->never, props, sizeof(props), &n); |
| 6596 | if (n != 0) { |
| 6597 | printf(" `%s` in %s: %s -> %s is bound, want no such edge\n", w->raw, w->rel, w->src, |
| 6598 | w->never); |
| 6599 | bad = 1; |
| 6600 | } |
| 6601 | } |
| 6602 | return bad; |
| 6603 | } |
| 6604 | |
| 6605 | /* Index `files` as a repository of their own and hold the result against |
| 6606 | * `wants`. Returns how many of them failed (each is printed), -1 when the |
no test coverage detected