Skip to content

Commit 0ea6769

Browse files
phantom assert
1 parent aa7c0b3 commit 0ea6769

File tree

2 files changed

+17
-9
lines changed
  • ouroboros-network-framework
    • sim-tests/Test/Ouroboros/Network/Server
    • src/Ouroboros/Network/ConnectionManager

2 files changed

+17
-9
lines changed

ouroboros-network-framework/sim-tests/Test/Ouroboros/Network/Server/Sim.hs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,12 +1896,16 @@ prop_connection_manager_pruning (Fixed rnd) serverAcc
18961896
-> Maybe (Either (WithName (Name SimAddr) (AbstractTransitionTrace SimAddr))
18971897
(WithName (Name SimAddr) (CM.Trace SimAddr
18981898
(ConnectionHandlerTrace UnversionedProtocol DataFlowProtocolData))))
1899-
fn _ (EventLog dyn) = Left <$> fromDynamic dyn
1900-
<|> Right <$> fromDynamic dyn
1899+
fn _ (EventLog dyn) = fromDynamic dyn
19011900
fn _ _ = Nothing
19021901

19031902
in tabulate "ConnectionEvents" (map showConnectionEvents events)
1904-
-- . counterexample (ppScript (MultiNodeScript events attenuationMap))
1903+
. counterexample (ppScript (MultiNodeScript events attenuationMap))
1904+
. counterexample (concat
1905+
[ "\n\n====== Say Events ======\n"
1906+
, intercalate "\n" $ selectTraceEventsSay' trace
1907+
, "\n"
1908+
])
19051909
. mkPropertyPruning
19061910
. bifoldMap
19071911
( \ case
@@ -1935,8 +1939,11 @@ prop_connection_manager_pruning (Fixed rnd) serverAcc
19351939
tpActivityTypes = [classifyActivityType trs],
19361940
tpTransitions = trs
19371941
}
1938-
Right b ->
1939-
mempty { tpNumberOfPrunings = classifyPruning b }
1942+
Right b
1943+
| CM.TrUnexpectedlyFalseAssertion assertionLoc <- b ->
1944+
mempty { tpProperty = counterexample (show assertionLoc) False }
1945+
| otherwise ->
1946+
mempty { tpNumberOfPrunings = classifyPruning b }
19401947
)
19411948
. fmap (first (map ttTransition))
19421949
. groupConnsEither id abstractStateIsFinalTransition
@@ -2324,7 +2331,7 @@ multiNodeSim stdGen serverAcc dataFlow defaultBearerInfo
23242331
acceptedConnLimit events attenuationMap = do
23252332
multiNodeSimTracer stdGen serverAcc dataFlow defaultBearerInfo acceptedConnLimit
23262333
events attenuationMap dynamicTracer dynamicTracer dynamicTracer
2327-
(Tracer traceM) dynamicTracer debugTracerG
2334+
(Tracer traceM) dynamicTracer dynamicTracer --debugTracerG
23282335

23292336

23302337
-- | Connection terminated while negotiating it.

ouroboros-network-framework/src/Ouroboros/Network/ConnectionManager/Core.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{-# LANGUAGE TupleSections #-}
1111
{-# LANGUAGE UndecidableInstances #-}
1212

13-
--{-# OPTIONS_GHC -fno-ignore-asserts #-}
13+
{-# OPTIONS_GHC -fno-ignore-asserts #-}
1414
-- | The implementation of connection manager.
1515
--
1616
-- The module should be imported qualified.
@@ -1210,8 +1210,9 @@ with args@Arguments {
12101210
, OperationSuccess KeepTr
12111211
, Nothing
12121212
)
1213-
OutboundDupState _connId _connThread _handle Expired ->
1214-
assert False $
1213+
OutboundDupState _connId _connThread _handle Expired -> do
1214+
void . throwIO . userError $ "0xdeadbeef"
1215+
-- assert False $
12151216
return ( Nothing
12161217
, Nothing
12171218
, OperationSuccess KeepTr

0 commit comments

Comments
 (0)