Skip to content

Commit 096c671

Browse files
committed
Pruning: Relax too strong assertion: PRUNED => !ARMED
If two Connect stages are sequenced, both sides can become ARMED. However, that means that the wave of PRUNED status updates, shouldn't overwrite a present ARMED state. Added unit test.
1 parent 8d7225d commit 096c671

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

core/src/storage.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ bool InterfaceState::Priority::operator<(const InterfaceState::Priority& other)
8383
}
8484

8585
void InterfaceState::updatePriority(const InterfaceState::Priority& priority) {
86-
// Never overwrite ARMED with PRUNED: PRUNED => !ARMED
87-
assert(priority.status() != InterfaceState::Status::PRUNED || priority_.status() != InterfaceState::Status::ARMED);
86+
// Never overwrite ARMED with PRUNED
87+
if (priority.status() == InterfaceState::Status::PRUNED && priority_.status() == InterfaceState::Status::ARMED)
88+
return;
8889

8990
if (owner()) {
9091
owner()->updatePriority(this, priority);

core/test/test_pruning.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,17 @@ TEST_F(Pruning, PropagateFromParallelContainerMultiplePaths) {
193193
// the failure in one branch of Alternatives must not prune computing back
194194
EXPECT_EQ(back->runs_, 1u);
195195
}
196+
197+
TEST_F(Pruning, TwoConnects) {
198+
add(t, new GeneratorMockup({ 0 }));
199+
add(t, new ForwardMockup({ INF }));
200+
add(t, new ConnectMockup());
201+
202+
add(t, new GeneratorMockup());
203+
add(t, new ConnectMockup());
204+
205+
add(t, new GeneratorMockup());
206+
add(t, new ForwardMockup());
207+
208+
EXPECT_FALSE(t.plan());
209+
}

0 commit comments

Comments
 (0)