Skip to content

Commit f8c17d4

Browse files
committed
[ misc ] various fixes & using a unique cabal file
1 parent 236fd5f commit f8c17d4

File tree

9 files changed

+21
-81
lines changed

9 files changed

+21
-81
lines changed

src/Test/Golden.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ runTest opts testPath = do
207207
putStr $ concat (testPath ∷ ": " ∷ [])
208208
time time′ $ callCommand $ unwords
209209
$ "cd" ∷ testPath
210-
"&&""sh ./run" ∷ opts .exeUnderTest
210+
"&&""sh ./run"(concat $ "\"" ∷ opts .exeUnderTest ∷ "\"" ∷ [])
211211
"| tr -d '\\r' > output"
212212
∷ []
213213

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CABAL_OPTIONS ?= --with-compiler $(GHC_EXEC)
66
AGDA_BUILD_DIR = _config/_build
77
CABAL_BUILD_DIR = _config/dist-newstyle
88

9-
./runtests: admin/runtests/runtests.agda
9+
./runtests: admin/runtests/Main.agda
1010
cd admin/runtests && AGDA="$(AGDA)" sh run
1111

1212
test: ./runtests

tests/README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ and running (change accordingly if you have the right versions of Agda
88
AGDA_EXEC=agda-2.6.4 GHC_EXEC=ghc-9.2.8 make testsuite
99
```
1010

11-
1211
# Structure of the test suite
1312

1413
## Configuration
@@ -24,24 +23,21 @@ the shared configuration and the resulting executable is copied to
2423
the root of the tests directory.
2524

2625
If you want to add new tests, you need to list them in
27-
[runtests.agda](admin/runtests/runtests.agda).
26+
the [runtests](admin/runtests/Main.agda) program.
2827

2928
## Test dependencies
3029

31-
The external dependencies of each test are spelt out in:
32-
33-
* either the generic [_config/template.cabal](_config/template.cabal) cabal file
34-
if they don't need any additional dependencies
35-
* or the test-specific cabal file (e.g. [data/appending/appending.cabal](data/appending/appending.cabal)) otherwise
30+
The external dependencies of the whole test suite are spelt out in the generic
31+
[_config/template.cabal](_config/template.cabal) cabal file
3632

3733
You may need to bump these dependencies when changing
38-
the version of the compiler backend we build against.
34+
the version of the GHC compiler we build against.
3935

4036
# Updating the test suite
4137

4238
1. Update [_config/version-numbers.sh](_config/version-numbers.sh)
43-
2. Update the command listing explicit version numbers at the top of this README
39+
2. Update the shell command listing explicit version numbers in the
40+
fenced code block at the top of this README
4441
3. Update bounds in [_config/template.cabal](_config/template.cabal)
45-
as well as all the test-specific cabal files in the X/Y/ subdirectories
4642
4. Update [../.github/workflows/ci-ubuntu.yml](../.github/workflows/ci-ubuntu.yml)
4743
to run the continuous integration with the new GHC and/or Agda versions.

tests/_config/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ goldenTest () {
4343
ln -sf "$CABAL_BUILD_DIR" dist-newstyle
4444

4545
# Compile the Agda module and build the generated code
46-
$AGDA --library-file=../../_config/libraries --compile-dir=_build -c --ghc-dont-call-ghc Main.agda > logs/agda-build
46+
"$AGDA" --library-file=../../_config/libraries --compile-dir=_build -c --ghc-dont-call-ghc Main.agda > logs/agda-build
4747
cabal build "$TEST_NAME" --with-compiler "$GHC_EXEC" > logs/cabal-build
4848

4949
# Run the test

tests/_config/template.cabal

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: TEST_NAME
3-
version: 2.0
3+
version: 0.0
44
build-type: Simple
55
description: Run this test
66
license: MIT
@@ -15,6 +15,11 @@ common common-build-parameters
1515

1616
build-depends:
1717
base >= 4.12 && < 4.20
18+
, clock >= 0.8 && <0.9
19+
, directory >= 1.3.6 && < 1.3.7
20+
, filemanip >= 0.3.6 && < 0.4
21+
, filepath >= 1.4 && <1.6
22+
, process >= 1.6 && <1.7
1823
, text >= 2.0 && <2.2
1924

2025
ghc-options: -Wno-missing-home-modules

tests/admin/runtests/Main.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{-# OPTIONS --guardedness #-}
22

3-
module runtests where
3+
module Main where
44

55
open import Data.List.Base as List using (_∷_; [])
66
open import Data.String.Base using (String; _++_)

tests/admin/runtests/run

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ TEST_NAME=runtests
55

66
# Specialise template agda-lib
77
sed "s/TEST_NAME/$TEST_NAME/g" ../../_config/template.agda-lib > "$TEST_NAME".agda-lib
8+
sed "s/TEST_NAME/$TEST_NAME/g" ../../_config/template.cabal > "$TEST_NAME".cabal
89

910
# Set up clean logs directory
1011
rm -rf logs/
@@ -20,13 +21,14 @@ mkdir -p "$CABAL_BUILD_DIR"
2021
ln -sf "$CABAL_BUILD_DIR" dist-newstyle
2122

2223
# Compile the Agda module and build the generated code
23-
$AGDA --library-file ../../_config/libraries --compile-dir=_build -c --ghc-dont-call-ghc runtests.agda > logs/agda-build
24+
$AGDA --library-file ../../_config/libraries --compile-dir=_build -c --ghc-dont-call-ghc Main.agda > logs/agda-build
2425
cabal build "$TEST_NAME" --with-compiler "$GHC_EXEC" > logs/cabal-build
2526

2627
# Copy the executable to the test root directory
2728
cp $(find dist-newstyle/ -name "runtests" -type f) ../../
2829

2930
# Clean up after ourselves
3031
rm "$TEST_NAME".agda-lib
32+
rm "$TEST_NAME".cabal
3133
rm _build
3234
rm dist-newstyle

tests/admin/runtests/runtests.cabal

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/system/environment/run

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,2 @@
1-
TEST_NAME=environment
2-
3-
# Use the shared version numbers
4-
. ../../_config/version-numbers.sh
5-
6-
# Specialise template agda-lib & cabal files
7-
sed "s/TEST_NAME/$TEST_NAME/g" ../../_config/template.agda-lib > "$TEST_NAME".agda-lib
8-
sed "s/TEST_NAME/$TEST_NAME/g" ../../_config/template.cabal > "$TEST_NAME".cabal
9-
10-
# Set up clean logs directory
11-
rm -rf logs/
12-
mkdir logs
13-
14-
# Use shared directories to avoid rechecking stdlib modules
15-
AGDA_BUILD_DIR=../../_config/_build
16-
CABAL_BUILD_DIR=../../_config/dist-newstyle
17-
18-
mkdir -p "$AGDA_BUILD_DIR"
19-
ln -sf "$AGDA_BUILD_DIR" _build
20-
mkdir -p "$CABAL_BUILD_DIR"
21-
ln -sf "$CABAL_BUILD_DIR" dist-newstyle
22-
23-
# Compile the Agda module and build the generated code
24-
$1 --library-file ../../_config/libraries --compile-dir=_build -c --ghc-dont-call-ghc Main.agda > logs/agda-build
25-
cabal build "$TEST_NAME" --with-compiler "$GHC_EXEC" > logs/cabal-build
26-
27-
# Run the test
28-
cabal exec -v0 "$TEST_NAME" --with-compiler "$GHC_EXEC" -- hello world > output
29-
30-
# Clean up after ourselves
31-
rm "$TEST_NAME".cabal
32-
rm "$TEST_NAME".agda-lib
33-
rm _build
34-
rm dist-newstyle
1+
. ../../_config/config.sh
2+
goldenTest $1 "environment"

0 commit comments

Comments
 (0)