Skip to content

Commit 86612f5

Browse files
committed
[ refactor ] share more code
1 parent 8dbf96c commit 86612f5

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

tests/_config/config.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
# This script is intended to be sourced from test scripts.
4+
#
5+
# It provides a number of default config options corresponding
6+
# to the compiler versions the stdlib is being tested with
7+
#
8+
# Usage: . PATH/TO/config.sh
9+
10+
set -e
11+
12+
if [ -z ${AGDA_EXEC} ]; then
13+
export AGDA_EXEC=agda-2.6.4
14+
fi
15+
16+
if [ -z ${GHC_EXEC} ]; then
17+
export GHC_EXEC=ghc-9.2.8
18+
fi

tests/show/num/num.cabal renamed to tests/_config/template.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cabal-version: 2.4
2-
name: num
2+
name: TEST_NAME
33
version: 2.0
44
build-type: Simple
55
description: Run this test
@@ -21,7 +21,7 @@ common common-build-parameters
2121

2222
ghc-options: -Wno-missing-home-modules
2323

24-
executable num
24+
executable TEST_NAME
2525
import: common-build-parameters
2626
hs-source-dirs: _build
2727
main-is: MAlonzo/Code/Main.hs

tests/show/num/run

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
TEST_NAME=num
22

33
# Get configuration information
4-
. ../../config.sh
4+
. ../../_config/config.sh
5+
6+
sed "s/TEST_NAME/$TEST_NAME/g" ../../_config/template.cabal > "$TEST_NAME".cabal
57

68
# Set up clean logs directory
79
rm -rf logs/
@@ -18,5 +20,6 @@ cabal build "$TEST_NAME" --with-compiler "$GHC_EXEC" > logs/cabal-build
1820
cabal exec -v0 "$TEST_NAME" --with-compiler "$GHC_EXEC" > output
1921

2022
# Clean up after ourselves
23+
rm "$TEST_NAME".cabal
2124
rm -R dist-newstyle
2225
rm -R _build/MAlonzo/Code/

0 commit comments

Comments
 (0)