Repository navigation
Open
Description
Hackage builder for some reason enforces -O0, which causes inspection tests to fail:
$ cabal run test:tests --ghc-options='-O0' -- --hide-successes
All
Properties
folds-unfolds
folds
_S_foldl'_from_foldlM' ==~ _S_foldl': FAIL
LHS:
_S_foldl'_from_foldlM'
= ... \ (f :: a -> Char -> a) (x :: a) ->
. runIdentity
(foldlM'
$fMonadIdentity
((\ (i :: a) (c :: Char) -> f i c) `cast` <Co:9> :: ...)
x)
RHS: _S_foldl' = ... inline foldl'
Use -p '/_S_foldl'\''_from_foldlM'\'' ==~ _S_foldl'\''/' to rerun this test only.
lowlevel
misc
t_literal_foo
mentions none of Char, List: FAIL
t_literal_foo :: Text
t_literal_foo = pack lvl_sNbt
lvl_sNbs :: Addr#
lvl_sNbs = "foo"#
lvl_sNbt :: [Char]
lvl_sNbt = unpackCString# lvl_sNbs
Use -p '/mentions none of Char, List/' to rerun this test only.
uses none of pack, unstream, map, safe, streamList: FAIL
t_literal_foo :: Text
t_literal_foo = pack lvl_sNbt
lvl_sNbs :: Addr#
lvl_sNbs = "foo"#
lvl_sNbt :: [Char]
lvl_sNbt = unpackCString# lvl_sNbs
Use -p '/uses none of pack, unstream, map, safe, streamList/' to rerun this test only.
uses none of unpackCString#, unpackCStringUtf8#: FAIL
t_literal_foo :: Text
t_literal_foo = pack lvl_sNbt
lvl_sNbs :: Addr#
lvl_sNbs = "foo"#
lvl_sNbt :: [Char]
lvl_sNbt = unpackCString# lvl_sNbs
Use -p '/uses none of unpackCString#, unpackCStringUtf8#/' to rerun this test only.
...which is kinda expected, but annoying.
In the wild: https://hackage.haskell.org/package/text-2.1.2/reports/2
Metadata
Metadata
Assignees
Labels
No labels
Activity
Lysxia commentedon May 15, 2025
Is there a way to detect that
-O0was used and disable the tests if so?Bodigrim commentedon May 15, 2025
The test itself forces
-O1:text/tests/Tests/Properties/LowLevel.hs
Lines 9 to 12 in 1994b13
The problem is that the library was built with
-O0, so whatever optimizations are enabled in tests they do not have access to optimized implementations of required functions.There are probably a few ways to solve this (such as force
-O1in required library modules, or set-fexpose-all-unfoldings), although neither solution feels robust enough. After all, maybe having a "failed tests" on Hackage is not that big deal. Also I don't know why Hackage wants to run tests with-O0.Lysxia commentedon May 15, 2025
One idea is to create a cabal flag specifically for enabling inspection tests and setting
-Oin the library.Bodigrim commentedon Oct 29, 2025
One way would be to put the following definition into, say,
Data.Text.Internal.Private:and then check the value of
isLibraryBuiltWithOptimizationsEnabledin the test suite. Dunno, is it too evil?