Skip to content

Commit 8b8e675

Browse files
committed
fix nar test lookup for src directory
Now also looks in `hnix-store-core/src` as well and won't fail even if either of them doesn't exist (which is not a big deal in this case).
1 parent 188bafb commit 8b8e675

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

hnix-store-core/tests/NarFormat.hs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import qualified Data.Map as Map
2323
import Data.Maybe (fromMaybe, isJust)
2424
import qualified Data.Text as T
2525
import GHC.Stats (getRTSStats, max_live_bytes)
26-
import System.Directory (removeFile)
26+
import System.Directory (doesDirectoryExist, removeFile)
2727
import System.Environment (getEnv)
2828
import qualified System.Process as P
2929
import Test.Tasty as T
@@ -106,12 +106,19 @@ unit_packSelfSrcDir = do
106106
case ver of
107107
Left (e :: SomeException) -> print "No nix-store on system"
108108
Right _ -> do
109-
hnixNar <- runPut . put <$> localPackNar narEffectsIO "src"
110-
nixStoreNar <- getNixStoreDump "src"
111-
HU.assertEqual
112-
"src dir serializes the same between hnix-store and nix-store"
113-
hnixNar
114-
nixStoreNar
109+
let go dir = do
110+
srcHere <- doesDirectoryExist dir
111+
case srcHere of
112+
False -> return ()
113+
True -> do
114+
hnixNar <- runPut . put <$> localPackNar narEffectsIO dir
115+
nixStoreNar <- getNixStoreDump dir
116+
HU.assertEqual
117+
"src dir serializes the same between hnix-store and nix-store"
118+
hnixNar
119+
nixStoreNar
120+
go "src"
121+
go "hnix-store-core/src"
115122

116123
unit_streamLargeFileToNar :: HU.Assertion
117124
unit_streamLargeFileToNar =

0 commit comments

Comments
 (0)