From a40ff920dc44dd06c12e71e631f7b56aa5e8ec5a Mon Sep 17 00:00:00 2001 From: Leon Schoorl Date: Thu, 20 Jun 2024 17:00:09 +0200 Subject: [PATCH] Fix the test for #1796 Something probably changed since it was introduced. It would prefer to read the source instead of the precompiled module and always succeed, even with the original fix reverted. --- tests/clash-testsuite.cabal | 6 ++--- tests/shouldwork/LoadModules/T1796.hs | 27 ++----------------- .../LoadModules/precompiled/T1796a.hs | 15 +++++++++++ 3 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 tests/shouldwork/LoadModules/precompiled/T1796a.hs diff --git a/tests/clash-testsuite.cabal b/tests/clash-testsuite.cabal index 243ee32c7c..df6cf11486 100644 --- a/tests/clash-testsuite.cabal +++ b/tests/clash-testsuite.cabal @@ -103,7 +103,7 @@ library -- Behaviour when loading modules can differ if the module is loaded from -- an external interface file. See -- https://github.com/clash-lang/clash-compiler/issues/1796 for an example. - shouldwork/LoadModules + shouldwork/LoadModules/precompiled exposed-modules: Test.Tasty.Common @@ -119,8 +119,8 @@ library Test.Tasty.Vivado Test.Tasty.Clash.CollectSimResults - -- From tests/shouldwork/LoadModules - T1796 + -- From tests/shouldwork/LoadModules/precompiled + T1796a other-modules: Paths_clash_testsuite diff --git a/tests/shouldwork/LoadModules/T1796.hs b/tests/shouldwork/LoadModules/T1796.hs index f7421da925..81f0a921bc 100644 --- a/tests/shouldwork/LoadModules/T1796.hs +++ b/tests/shouldwork/LoadModules/T1796.hs @@ -4,29 +4,6 @@ module T1796 where -import Clash.Prelude +import T1796a -import Clash.Explicit.Testbench - -topEntity - :: Signal System Bool - -> Signal System Bool -topEntity = id --- See: https://github.com/clash-lang/clash-compiler/pull/2511 -{-# CLASH_OPAQUE topEntity #-} - -tb - :: Signal System Bool -tb = done - where - testInput = stimuliGenerator clk rst (singleton True) - expectOutput = outputVerifier' clk rst (singleton True) - done = expectOutput $ topEntity testInput - clk = tbClockGen @System (not <$> done) - rst = resetGen @System -{-# INLINE tb #-} - -testBench :: Signal System Bool -testBench = tb --- See: https://github.com/clash-lang/clash-compiler/pull/2511 -{-# CLASH_OPAQUE testBench #-} +topEntity = tb diff --git a/tests/shouldwork/LoadModules/precompiled/T1796a.hs b/tests/shouldwork/LoadModules/precompiled/T1796a.hs new file mode 100644 index 0000000000..ce67bdcf13 --- /dev/null +++ b/tests/shouldwork/LoadModules/precompiled/T1796a.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE TypeApplications #-} + +module T1796a where + +import Clash.Explicit.Prelude +import Clash.Explicit.Testbench + +tb :: Signal System Bool +tb = done + where + done = register clk rst enableGen False $ id (pure True) + clk = tbClockGen @System (not <$> done) + rst = resetGen @System