-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes the dependency on Stack, in several ways: * Removes the use of Stack in the test suite. * Updates `build.sh` to use `cabal build`. * Updates coverage.sh to use `cabal build --enable-coverage`. * Updates the README to describe how to build with `cabal`. * Removes Stack configuration files. It also fixes a broken test along the way.
- Loading branch information
Aaron Tomb
authored
Jan 13, 2021
1 parent
d133abd
commit 21565d7
Showing
9 changed files
with
53 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,18 @@ | ||
#!/bin/bash | ||
set -x | ||
set -v | ||
set -e | ||
git submodule update --init | ||
(cd deps/abcBridge && git submodule update --init) | ||
|
||
TESTABLE="abcBridge jvm-verifier parameterized-utils saw-core" | ||
function install() { | ||
cp $(find dist-newstyle -type f -name $1 | sort -g | tail -1) bin/ | ||
} | ||
|
||
dotests="false" | ||
jobs="" | ||
while getopts "tpfj:" opt; do | ||
case $opt in | ||
t) | ||
dotests="true" | ||
;; | ||
j) | ||
jobs="-j$OPTARG" | ||
;; | ||
\?) | ||
echo "Invalid option: -$OPTARG" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
cabal build exe:cryptol exe:jss exe:saw exe:saw-remote-api | ||
|
||
git submodule init | ||
git submodule update | ||
(cd deps/abcBridge && git submodule init && git submodule update) | ||
rm -rf bin && mkdir bin | ||
install cryptol | ||
install jss | ||
install saw | ||
install saw-remote-api | ||
|
||
if [ ! -e stack.yaml -a -z "$STACK_YAML" ] ; then | ||
set +x | ||
echo | ||
echo "ERROR: no stack.yaml file found." | ||
echo | ||
echo "Select one of the given stack configuration files using:" | ||
echo | ||
echo " ln -s stack.<ghc version and os>.yaml stack.yaml" | ||
exit 1 | ||
fi | ||
|
||
stack setup | ||
|
||
LOCALBINPATH=$(stack path --local-bin-path | tr -d '\r\n') | ||
if [ "${OS}" == "Windows_NT" ] ; then | ||
HERE=$(cygpath -w $(pwd)) | ||
PATH=$PATH:$(cygpath -u -a $LOCALBINPATH) | ||
else | ||
HERE=$(pwd) | ||
PATH=$PATH:$LOCALBINPATH | ||
fi | ||
|
||
stack="stack $jobs" | ||
|
||
${stack} install alex | ||
${stack} install happy | ||
${stack} install c2hs | ||
|
||
which alex | ||
which happy | ||
which c2hs | ||
|
||
if [ "${dotests}" == "true" ] ; then | ||
if [ -z ${TEST_TIMEOUT} ]; then | ||
TEST_TIMEOUT="120s" | ||
fi | ||
|
||
mkdir -p tmp | ||
for pkg in ${TESTABLE}; do | ||
test_arguments="--xml=${HERE}/tmp/${pkg}-test-results.xml --timeout=${TEST_TIMEOUT}" | ||
|
||
if [ ! "${QC_TESTS}" == "" ]; then | ||
test_arguments="${test_arguments} --quickcheck-tests=${QC_TESTS}" | ||
fi | ||
|
||
# Stack is returning 1 when a test fails, which kills the whole | ||
# build. Presumably Cabal returned 0 in this case. | ||
# | ||
# If the build part of the test fails, there won't be any XML | ||
# file, so we'll detect failure in that case when we check for the | ||
# XML file below. | ||
( | ||
set +e | ||
${stack} build --test --test-arguments="${test_arguments}" ${pkg} | ||
exit 0 | ||
) | ||
|
||
if [ -e tmp/${pkg}-test-results.xml ]; then | ||
xsltproc jenkins-junit-munge.xsl tmp/${pkg}-test-results.xml > tmp/jenkins-${pkg}-test-results.xml | ||
else | ||
echo "Missing test results: tmp/${pkg}-test-results.xml" | ||
exit 1 | ||
fi | ||
done | ||
else | ||
${stack} build | ||
fi | ||
|
||
# Link bin directory to a more convenient location | ||
rm -f bin | ||
ln -s `stack path --local-install-root`/bin | ||
set +x +v | ||
echo | ||
echo "COPIED EXECUTABLES TO `pwd`/bin." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
#!/bin/bash | ||
|
||
stack build --coverage | ||
cabal build --enable-coverage exe:jss exe:saw | ||
|
||
(cd intTests && ./runtests.sh) | ||
# This conflicts with GitRev.mix in `saw-script`. Yuck. | ||
rm -f ./dist-newstyle/build/*/ghc-*/cryptol-*/**/GitRev.mix | ||
|
||
hpc sum --output=saw.tix --union --exclude=Main `find intTests -name "*.tix"` | ||
(cd intTests && CABAL_FLAGS="--enable-coverage" ./runtests.sh) | ||
|
||
stack hpc report --destdir=coverage saw.tix | ||
hpc sum --output=saw.tix --union --exclude=Main $(find intTests -name saw.tix) | ||
|
||
HPC_ARGS="--destdir=coverage" | ||
|
||
# Collect up all the directories where `.mix` files might live. This is | ||
# horrendous. | ||
HPC_DIRS=$(find dist-newstyle -name "*.mix" | xargs -n 1 dirname | sort -u | grep -v dyn) | ||
HPC_DIRS2=$(find dist-newstyle -name "*.mix" | xargs -n 1 dirname | xargs -n 1 dirname | sort -u | grep -v dyn) | ||
for dir in ${HPC_DIRS}; do | ||
HPC_ARGS="${HPC_ARGS} --hpcdir=${dir}" | ||
done | ||
for dir in ${HPC_DIRS2}; do | ||
HPC_ARGS="${HPC_ARGS} --hpcdir=${dir}" | ||
done | ||
|
||
# Add the top-level directory of each dependency package to the source | ||
# file search path. | ||
HPC_ARGS="${HPC_ARGS} --srcdir=." | ||
for dir in $(cat cabal.project | grep -v : | grep -v "\.cabal") ; do | ||
HPC_ARGS="${HPC_ARGS} --srcdir=${dir}" | ||
done | ||
|
||
hpc markup ${HPC_ARGS} saw.tix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.