Propagate error code in test
This commit is contained in:
@@ -540,6 +540,7 @@ void checkParentPointers(Node *node, bool &success) {
|
|||||||
fprintf(stderr, "%.*s child %d has parent pointer %p. Expected %p\n",
|
fprintf(stderr, "%.*s child %d has parent pointer %p. Expected %p\n",
|
||||||
node->len, (const char *)(node + 1), i,
|
node->len, (const char *)(node + 1), i,
|
||||||
(void *)node->child[i]->parent, (void *)node);
|
(void *)node->child[i]->parent, (void *)node);
|
||||||
|
success = false;
|
||||||
}
|
}
|
||||||
checkParentPointers(node->child[i], success);
|
checkParentPointers(node->child[i], success);
|
||||||
}
|
}
|
||||||
@@ -556,8 +557,8 @@ int64_t checkMaxVersion(Node *node, bool &success) {
|
|||||||
if (node->maxVersion != expected) {
|
if (node->maxVersion != expected) {
|
||||||
fprintf(stderr, "%.*s has max version %d. Expected %d\n", node->len,
|
fprintf(stderr, "%.*s has max version %d. Expected %d\n", node->len,
|
||||||
(const char *)(node + 1), int(node->maxVersion), int(expected));
|
(const char *)(node + 1), int(node->maxVersion), int(expected));
|
||||||
}
|
|
||||||
success = false;
|
success = false;
|
||||||
|
}
|
||||||
return expected;
|
return expected;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -623,8 +624,8 @@ struct ConflictSet::Impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct StepwiseInsert {
|
struct StepwiseInsert {
|
||||||
// Search phase state. After this phase, the heap invariant may be violated
|
// After this phase, the heap invariant may be violated for
|
||||||
// for (*current)->parent.
|
// (*current)->parent.
|
||||||
Node **current;
|
Node **current;
|
||||||
Node *parent;
|
Node *parent;
|
||||||
const Key *key;
|
const Key *key;
|
||||||
@@ -643,7 +644,7 @@ struct ConflictSet::Impl {
|
|||||||
if (*current == nullptr) {
|
if (*current == nullptr) {
|
||||||
auto *newNode = createNode(*key, parent, writeVersion);
|
auto *newNode = createNode(*key, parent, writeVersion);
|
||||||
*current = newNode;
|
*current = newNode;
|
||||||
// We could interleave the iteration in next, but we'd need a careful
|
// We could interleave the iteration in ::next, but we'd need a careful
|
||||||
// analysis for correctness and it's unlikely to be worthwhile.
|
// analysis for correctness and it's unlikely to be worthwhile.
|
||||||
auto *prev = ::next(newNode, false);
|
auto *prev = ::next(newNode, false);
|
||||||
assert(prev != nullptr);
|
assert(prev != nullptr);
|
||||||
@@ -797,6 +798,7 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
cs.addWrites(write, kNumKeys);
|
cs.addWrites(write, kNumKeys);
|
||||||
debugPrintDot(stdout, cs.root);
|
debugPrintDot(stdout, cs.root);
|
||||||
checkInvariants(cs.root);
|
bool success = checkInvariants(cs.root);
|
||||||
|
return success ? 0 : 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
Reference in New Issue
Block a user