diff --git a/Makefile b/Makefile index 9ff92037e..60b39e1ba 100644 --- a/Makefile +++ b/Makefile @@ -352,10 +352,20 @@ tools/generatejournal: tools/generatejournal.hs ###################################################################### # TESTING - +# developer environment checks ###################################################################### # DOCUMENTATION +check: + @echo sanity-check developer environment: + @($(SHELLTEST) checks -- --threads=8 \ + && echo $@ PASSED) || echo $@ FAILED + + + +# run packdeps on each package to check for disallowed newer dependencies +packdeps: + for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done ###################################################################### # RELEASING @@ -365,9 +375,6 @@ tools/generatejournal: tools/generatejournal.hs # set-up-rc-repo: # cd site/_site; ln -s ../download -checkdeps packdeps: - for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done - ###################################################################### # MISCELLANEOUS diff --git a/checks/10-cabal-installed.test b/checks/10-cabal-installed.test new file mode 100644 index 000000000..27291e433 --- /dev/null +++ b/checks/10-cabal-installed.test @@ -0,0 +1,5 @@ +# cabal 1.20 or greater +cabal --version +>>> /cabal-install version (1\.(2[0-9]|[3-9])|[2-9])/ +>>>= 0 + diff --git a/checks/10-ghc-installed.test b/checks/10-ghc-installed.test new file mode 100644 index 000000000..354bbb606 --- /dev/null +++ b/checks/10-ghc-installed.test @@ -0,0 +1,4 @@ +# GHC 7.4 or greater +ghc --version +>>> /7.(4|6|8|[12][0-9])/ +>>>= 0 diff --git a/checks/20-ghc-pkg-check.test b/checks/20-ghc-pkg-check.test new file mode 100644 index 000000000..ff122bb70 --- /dev/null +++ b/checks/20-ghc-pkg-check.test @@ -0,0 +1,4 @@ +# ghc-pkg check (or the sandbox equivalent) reports no errors +[[ -e cabal.sandbox.config ]] && cabal sandbox hc-pkg check || ghc-pkg check +>>>2 !/(There are problems|The following packages are broken)/ +>>>= 0 diff --git a/checks/31-hledger-lib-cabal-deps-installed.test b/checks/31-hledger-lib-cabal-deps-installed.test new file mode 100644 index 000000000..f166b1ba6 --- /dev/null +++ b/checks/31-hledger-lib-cabal-deps-installed.test @@ -0,0 +1,5 @@ +# hledger-lib's cabal dependencies are installed +cabal install ./hledger-lib --only-dep --dry || echo HINT: cabal install ./hledger-lib --only-dep +>>> /All the requested packages are already installed/ +>>>2 +>>>= 0 diff --git a/checks/32-hledger-cli-cabal-deps-installed.test b/checks/32-hledger-cli-cabal-deps-installed.test new file mode 100644 index 000000000..1423c896c --- /dev/null +++ b/checks/32-hledger-cli-cabal-deps-installed.test @@ -0,0 +1,5 @@ +# hledger's cabal dependencies are installed +cabal install ./hledger --only-dep --dry || echo HINT: cabal install ./hledger-lib +>>> /All the requested packages are already installed/ +>>>2 +>>>= 0 diff --git a/checks/33-hledger-web-cabal-deps-installed.test b/checks/33-hledger-web-cabal-deps-installed.test new file mode 100644 index 000000000..1e8388cea --- /dev/null +++ b/checks/33-hledger-web-cabal-deps-installed.test @@ -0,0 +1,5 @@ +# hledger-lib's cabal dependencies are installed +cabal install ./hledger-web --only-dep --dry || echo HINT: cabal install ./hledger +>>> /All the requested packages are already installed/ +>>>2 +>>>= 0 diff --git a/checks/41-hledger-lib-cabal-repl.test b/checks/41-hledger-lib-cabal-repl.test new file mode 100644 index 000000000..7b5d3871b --- /dev/null +++ b/checks/41-hledger-lib-cabal-repl.test @@ -0,0 +1,5 @@ +# cabal repl works for hledger-lib +echo :q | make repl-lib | tail +>>> /Ok, modules loaded: Hledger, / +>>>2 +>>>= 0 diff --git a/checks/42-hledger-cli-cabal-repl.test b/checks/42-hledger-cli-cabal-repl.test new file mode 100644 index 000000000..29cf00cb6 --- /dev/null +++ b/checks/42-hledger-cli-cabal-repl.test @@ -0,0 +1,5 @@ +# cabal repl works for hledger +echo :q | make repl | tail +>>> /Ok, modules loaded: Hledger.Cli, / +>>>2 +>>>= 0 diff --git a/checks/43-hledger-web-cabal-repl.test b/checks/43-hledger-web-cabal-repl.test new file mode 100644 index 000000000..98236345c --- /dev/null +++ b/checks/43-hledger-web-cabal-repl.test @@ -0,0 +1,5 @@ +# cabal repl works for hledger-web +echo :q | make repl-web | tail +>>> /Ok, modules loaded: Settings, Main, Hledger.Web.Main, / +>>>2 +>>>= 0 diff --git a/checks/51-make-ghci.test b/checks/51-make-ghci.test new file mode 100644 index 000000000..2a1b0fc8c --- /dev/null +++ b/checks/51-make-ghci.test @@ -0,0 +1,4 @@ +# hledger+hledger-lib GHCI prompt works +echo :q | make ghci | tail +>>> /Ok, modules loaded: Hledger, / +>>>= 0 diff --git a/checks/52-make-ghci-web.test b/checks/52-make-ghci-web.test new file mode 100644 index 000000000..8861bb05e --- /dev/null +++ b/checks/52-make-ghci-web.test @@ -0,0 +1,4 @@ +# hledger-web+hledger+hledger-lib GHCI prompt works +echo :q | make ghciweb | tail +>>> /Ok, modules loaded: Settings, Main, / +>>>= 0 diff --git a/checks/README b/checks/README new file mode 100644 index 000000000..32e332b2e --- /dev/null +++ b/checks/README @@ -0,0 +1 @@ +Shell tests which aim to help developers maintain a working environment. \ No newline at end of file