on iko/ghcjs-patch-master help sign in
tests: add shell script which runs all tests
commita8adc34e27c23c6b297bda8b720a64b42e121ef1 authorRodney Lorrimar <rodney.lorrimar@iohk.io> dateWed 30 Jan 2019, 15:36 (8 years ago) parentce0f5e0
2 files changed+40−5
.travis.yml+1−5 test/tests.sh+39
.travis.yml+1−5
@@ -19,8 +19,4 @@ before_script:
1919script:
2020- nix-env -if https://github.com/cachix/cachix/tarball/master --extra-substituters https://cachix.cachix.org --trusted-public-keys 'cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM='
2121- cachix use nix-tools
22−- nix-build
23− -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/${CHANNEL}.tar.gz
24− test/default.nix
25− --cores 0
26− -j2
22+- NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/${CHANNEL}.tar.gz NIX_BUILD_ARGS="--cores 0 --max-jobs 2" ./test/tests.sh
test/tests.shnew file+39
@@ -0,0 +1,39 @@
1+#! /usr/bin/env nix-shell
2+#! nix-shell -i bash -p bash jq nix
3+
4+set -euo pipefail
5+
6+NIX_BUILD_ARGS="${NIX_BUILD_ARGS:-}"
7+
8+cd $(dirname $0)
9+
10+printf "*** Running the nix-build tests...\n" >& 2
11+nix-build $NIX_BUILD_ARGS --no-out-link --keep-going ./default.nix
12+echo >& 2
13+
14+printf "*** Running the unit tests... " >& 2
15+res=$(nix-instantiate --eval --json --strict ./default.nix -A unit)
16+num_failed=$(jq length <<< "$res")
17+if [ $num_failed -eq 0 ]; then
18+ printf "PASSED\n" >& 2
19+else
20+ printf "$num_failed FAILED\n" >& 2
21+ jq . <<< "$res"
22+ exit 1
23+fi
24+
25+printf "*** Checking that a nix-shell works for runghc...\n" >& 2
26+nix-shell $NIX_BUILD_ARGS \
27+ --pure ./default.nix \
28+ -A with-packages.test-shell \
29+ --run 'runghc with-packages/Point.hs'
30+echo >& 2
31+
32+printf "*** Checking that a nix-shell works for cabal...\n" >& 2
33+nix-shell $NIX_BUILD_ARGS \
34+ --pure ./default.nix \
35+ -A with-packages.test-shell \
36+ --run 'echo CABAL_CONFIG=$CABAL_CONFIG && type -p ghc && cd with-packages && rm -rf dist-newstyle .ghc-environment* && cabal new-build'
37+echo >& 2
38+
39+printf "\n*** Finished successfully\n" >& 2