mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-09-11 18:05:56 +03:00
Put bounded-memory NAR format tests behind a cabal flag deaulting to False
The test suite fails when run naively, due to the use of haskell code that uses gc statistics, and requires `+RTS -T` flags be passed to the testsuite. We opt in to this flag for CI and for any default.nix that packages hnix-store-core.
This commit is contained in:
parent
ec29e02e2b
commit
6734486e06
@ -47,7 +47,13 @@ library
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
|
||||
Flag bounded_memory
|
||||
description: Run tests of constant memory use (requires +RTS -T)
|
||||
default: False
|
||||
|
||||
test-suite format-tests
|
||||
if flag(bounded_memory)
|
||||
cpp-options: -DBOUNDED_MEMORY
|
||||
ghc-options: -rtsopts -fprof-auto
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: Driver.hs
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
@ -161,8 +162,12 @@ filesystemNixStore testErrorName n = do
|
||||
-- | Assert that GHC uses less than 100M memory at peak
|
||||
assertBoundedMemory :: IO ()
|
||||
assertBoundedMemory = do
|
||||
#ifdef BOUNDED_MEMORY
|
||||
bytes <- max_live_bytes <$> getRTSStats
|
||||
bytes < 100 * 1000 * 1000 `shouldBe` True
|
||||
#else
|
||||
return ()
|
||||
#endif
|
||||
|
||||
|
||||
-- | Read the binary output of `nix-store --dump` for a filepath
|
||||
@ -250,58 +255,63 @@ sampleLargeDir fSize = Directory $ Map.fromList $ [
|
||||
|
||||
-- "hi" file turned to a NAR with `nix-store --dump`, Base64 encoded
|
||||
sampleRegularBaseline :: BSL.ByteString
|
||||
sampleRegularBaseline = B64.decodeLenient
|
||||
"DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA\
|
||||
\AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA\
|
||||
\AAAABjb250ZW50cwMAAAAAAAAAaGkKAAAAAAABAAAAAAAAACkAA\
|
||||
\AAAAAAA"
|
||||
sampleRegularBaseline = B64.decodeLenient $ BSL.concat
|
||||
["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA"
|
||||
,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA"
|
||||
,"AAAABjb250ZW50cwMAAAAAAAAAaGkKAAAAAAABAAAAAAAAACkAA"
|
||||
,"AAAAAAA"
|
||||
]
|
||||
|
||||
sampleRegular'Baseline :: BSL.ByteString
|
||||
sampleRegular'Baseline = B64.decodeLenient
|
||||
"DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA\
|
||||
\AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA\
|
||||
\AAAABjb250ZW50c0AAAAAAAAAAI2luY2x1ZGUgPHN0ZGlvLmg+C\
|
||||
\gppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKXsgZXhp\
|
||||
\dCAwOyB9CgEAAAAAAAAAKQAAAAAAAAA="
|
||||
sampleRegular'Baseline = B64.decodeLenient $ BSL.concat
|
||||
["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA"
|
||||
,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACAAAAA"
|
||||
,"AAAABjb250ZW50c0AAAAAAAAAAI2luY2x1ZGUgPHN0ZGlvLmg+C"
|
||||
,"gppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKXsgZXhp"
|
||||
,"dCAwOyB9CgEAAAAAAAAAKQAAAAAAAAA="
|
||||
]
|
||||
|
||||
sampleExecutableBaseline :: BSL.ByteString
|
||||
sampleExecutableBaseline = B64.decodeLenient
|
||||
"DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA\
|
||||
\AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACgAAAA\
|
||||
\AAAABleGVjdXRhYmxlAAAAAAAAAAAAAAAAAAAIAAAAAAAAAGNvb\
|
||||
\nRlbnRzIgAAAAAAAAAjIS9iaW4vYmFzaAoKZ2NjIC1vIGhlbGxv\
|
||||
\IGhlbGxvLmMKAAAAAAAAAQAAAAAAAAApAAAAAAAAAA=="
|
||||
sampleExecutableBaseline = B64.decodeLenient $ BSL.concat
|
||||
["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA"
|
||||
,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHJlZ3VsYXIACgAAAA"
|
||||
,"AAAABleGVjdXRhYmxlAAAAAAAAAAAAAAAAAAAIAAAAAAAAAGNvb"
|
||||
,"nRlbnRzIgAAAAAAAAAjIS9iaW4vYmFzaAoKZ2NjIC1vIGhlbGxv"
|
||||
,"IGhlbGxvLmMKAAAAAAAAAQAAAAAAAAApAAAAAAAAAA=="
|
||||
]
|
||||
|
||||
sampleSymLinkBaseline :: BSL.ByteString
|
||||
sampleSymLinkBaseline = B64.decodeLenient
|
||||
"DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA\
|
||||
\AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHN5bWxpbmsABgAAAA\
|
||||
\AAAAB0YXJnZXQAAAcAAAAAAAAAaGVsbG8uYwABAAAAAAAAACkAA\
|
||||
\AAAAAAA"
|
||||
sampleSymLinkBaseline = B64.decodeLenient $ BSL.concat
|
||||
["DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA"
|
||||
,"AAAQAAAAAAAAAdHlwZQAAAAAHAAAAAAAAAHN5bWxpbmsABgAAAA"
|
||||
,"AAAAB0YXJnZXQAAAcAAAAAAAAAaGVsbG8uYwABAAAAAAAAACkAA"
|
||||
,"AAAAAAA"
|
||||
]
|
||||
|
||||
sampleDirectoryBaseline :: BSL.ByteString
|
||||
sampleDirectoryBaseline = B64.decodeLenient
|
||||
"DQAAAAAAAABuaXgtYXJjaGl2ZS0xAAAAAQAAAAAAAAAoAAAAAAA\
|
||||
\AAAQAAAAAAAAAdHlwZQAAAAAJAAAAAAAAAGRpcmVjdG9yeQAAAA\
|
||||
\AAAAAFAAAAAAAAAGVudHJ5AAAAAQAAAAAAAAAoAAAAAAAAAAQAA\
|
||||
\AAAAAAAbmFtZQAAAAAIAAAAAAAAAGJ1aWxkLnNoBAAAAAAAAABu\
|
||||
\b2RlAAAAAAEAAAAAAAAAKAAAAAAAAAAEAAAAAAAAAHR5cGUAAAA\
|
||||
\ABwAAAAAAAAByZWd1bGFyAAoAAAAAAAAAZXhlY3V0YWJsZQAAAA\
|
||||
\AAAAAAAAAAAAAACAAAAAAAAABjb250ZW50cyIAAAAAAAAAIyEvY\
|
||||
\mluL2Jhc2gKCmdjYyAtbyBoZWxsbyBoZWxsby5jCgAAAAAAAAEA\
|
||||
\AAAAAAAAKQAAAAAAAAABAAAAAAAAACkAAAAAAAAABQAAAAAAAAB\
|
||||
\lbnRyeQAAAAEAAAAAAAAAKAAAAAAAAAAEAAAAAAAAAG5hbWUAAA\
|
||||
\AABwAAAAAAAABoZWxsby5jAAQAAAAAAAAAbm9kZQAAAAABAAAAA\
|
||||
\AAAACgAAAAAAAAABAAAAAAAAAB0eXBlAAAAAAcAAAAAAAAAcmVn\
|
||||
\dWxhcgAIAAAAAAAAAGNvbnRlbnRzQAAAAAAAAAAjaW5jbHVkZSA\
|
||||
\8c3RkaW8uaD4KCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcm\
|
||||
\d2W10peyBleGl0IDA7IH0KAQAAAAAAAAApAAAAAAAAAAEAAAAAA\
|
||||
\AAAKQAAAAAAAAAFAAAA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AAAAAAcAAAAAAAAAcmVn"
|
||||
,"dWxhcgAIAAAAAAAAAGNvbnRlbnRzQAAAAAAAAAAjaW5jbHVkZSA"
|
||||
,"8c3RkaW8uaD4KCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcm"
|
||||
,"d2W10peyBleGl0IDA7IH0KAQAAAAAAAAApAAAAAAAAAAEAAAAAA"
|
||||
,"AAAKQAAAAAAAAAFAAAAAAAAAGVudHJ5AAAAAQAAAAAAAAAoAAAA"
|
||||
,"AAAAAAQAAAAAAAAAbmFtZQAAAAAEAAAAAAAAAGhpLmMAAAAABAA"
|
||||
,"AAAAAAABub2RlAAAAAAEAAAAAAAAAKAAAAAAAAAAEAAAAAAAAAH"
|
||||
,"R5cGUAAAAABwAAAAAAAABzeW1saW5rAAYAAAAAAAAAdGFyZ2V0A"
|
||||
,"AAHAAAAAAAAAGhlbGxvLmMAAQAAAAAAAAApAAAAAAAAAAEAAAAA"
|
||||
,"AAAAKQAAAAAAAAABAAAAAAAAACkAAAAAAAAA"
|
||||
]
|
||||
|
||||
|
||||
-- | Control testcase sizes (bytes) by env variable
|
||||
|
Loading…
Reference in New Issue
Block a user