on master help sign in
staticWhich all the things
commit82e114be0adaf1cb49278659a1e8f8ac5e97ac2c authorleon.smith@obsidian.systems <leon.smith@obsidian.systems> dateTue 28 Jan 2020, 16:58 (7 years ago) parent0d2b963
2 files changed+25−6
default.nix+1 lib/selftest/src/Obelisk/SelfTest.hs+24−6
default.nix+1
@@ -72,6 +72,7 @@ let
7272 pkgs.cabal-install
7373 pkgs.coreutils
7474 pkgs.git
75+ pkgs.nix
7576 ];
7677 };
7778 obelisk-snap-extras = self.callCabal2nix "obelisk-snap-extras" (cleanSource ./lib/snap-extras) {};
lib/selftest/src/Obelisk/SelfTest.hs+24−6
@@ -55,6 +55,24 @@ cabalPath = $(staticWhich "cabal")
5555gitPath :: FilePath
5656gitPath = $(staticWhich "git")
5757
58+chownPath :: FilePath
59+chownPath = $(staticWhich "chown")
60+
61+chmodPath :: FilePath
62+chmodPath = $(staticWhich "chmod")
63+
64+whoamiPath :: FilePath
65+whoamiPath = $(staticWhich "whoami")
66+
67+nixBuildPath :: FilePath
68+nixBuildPath = $(staticWhich "nix-build")
69+
70+lnPath :: FilePath
71+lnPath = $(staticWhich "ln")
72+
73+rmPath :: FilePath
74+rmPath = $(staticWhich "rm")
75+
5876gitUserConfig :: [Text]
5977gitUserConfig = ["-c", "user.name=Obelisk Selftest", "-c", "user.email=noreply@example.com"]
6078
@@ -95,7 +113,7 @@ main = do
95113 unless isVerbose $
96114 putStrLn "Tests may take longer to run if there are unbuilt derivations: use -v for verbose output"
97115 let verbosity = bool silently verbosely isVerbose
98− nixBuild args = run "nix-build" ("--no-out-link" : args)
116+ nixBuild args = run nixBuildPath ("--no-out-link" : args)
99117 obeliskImplDirtyReadOnly <- fromString <$> getCurrentDirectory
100118 let runOb_ = augmentWithVerbosity run_ ob isVerbose
101119 let runOb = augmentWithVerbosity run ob isVerbose
@@ -111,10 +129,10 @@ main = do
111129 withObeliskImplDirty f =
112130 withSystemTempDirectory "obelisk-impl-copy" $ \(fromString -> obeliskImpl) -> do
113131 void . shellyOb verbosity $ chdir obeliskImpl $ do
114− user <- T.strip <$> run "whoami" []
132+ user <- T.strip <$> run whoamiPath []
115133 run_ cp ["-rT", "--no-preserve=mode", toTextIgnore obeliskImplDirtyReadOnly, toTextIgnore obeliskImpl]
116− run_ "chown" ["-R", user, toTextIgnore obeliskImpl]
117− run_ "chmod" ["-R", "g-rw,o-rw", toTextIgnore obeliskImpl]
134+ run_ chownPath ["-R", user, toTextIgnore obeliskImpl]
135+ run_ chmodPath ["-R", "g-rw,o-rw", toTextIgnore obeliskImpl]
118136 f obeliskImpl
119137
120138 withInitCache f obeliskImpl =
@@ -152,8 +170,8 @@ main = do
152170 -- To be used in tests that change the obelisk impl directory
153171 inTmpObInitWithImplCopy f = inTmpObInit $ \dir ->
154172 withObeliskImplClean $ \(fromString -> implClean) -> do
155− run_ "rm" [thunk]
156− run_ "ln" ["-s", implClean, thunk]
173+ run_ rmPath [thunk]
174+ run_ lnPath ["-s", implClean, thunk]
157175 f dir
158176
159177 assertRevEQ a b = liftIO . assertEqual "" "" =<< diff a b