[ test ] add IDRIS2_TESTS_CG env variable

This commit is contained in:
Guillaume ALLAIS 2020-10-16 14:02:27 +01:00 committed by G. Allais
parent 482527063c
commit 7192ef28a3
6 changed files with 36 additions and 6 deletions

View File

@ -11,6 +11,8 @@ on:
env:
SCHEME: scheme
IDRIS2_TESTS_CG: chez
jobs:
build:
runs-on: ubuntu-latest

View File

@ -10,6 +10,8 @@ on:
- master
env:
SCHEME: chez
IDRIS2_TESTS_CG: chez
jobs:
build:
runs-on: macos-latest

View File

@ -9,6 +9,9 @@ on:
branches:
- master
env:
IDRIS2_TESTS_CG: racket
jobs:
build:
runs-on: ubuntu-latest
@ -22,4 +25,3 @@ jobs:
- name: Build from bootstrap
run: make bootstrap-racket
shell: bash

View File

@ -11,6 +11,8 @@ on:
env:
SCHEME: scheme
IDRIS2_TESTS_CG: chez
jobs:
build:
runs-on: ubuntu-latest
@ -27,4 +29,3 @@ jobs:
- name: Build and test self-hosted
run: make clean && make all && make test INTERACTIVE=''
shell: bash

View File

@ -12,6 +12,7 @@ env:
MSYSTEM: MINGW64
MSYS2_PATH_TYPE: inherit
SCHEME: scheme
IDRIS2_TESTS_CG: chez
CC: gcc
jobs:

View File

@ -165,6 +165,8 @@ record Options where
constructor MkOptions
||| Name of the idris2 executable
idris2 : String
||| Name of the codegenerator to use for `exec`
codegen : Maybe String
||| Should we only run some specific cases?
onlyNames : List String
||| Should we run the test suite interactively?
@ -175,7 +177,7 @@ usage = "Usage: runtests <idris2 path> [--interactive] [--only [NAMES]]"
options : List String -> Maybe Options
options args = case args of
(_ :: idris2 :: rest) => go rest (MkOptions idris2 [] False)
(_ :: idris2 :: rest) => go rest (MkOptions idris2 Nothing [] False)
_ => Nothing
where
@ -184,6 +186,7 @@ options args = case args of
go rest opts = case rest of
[] => pure opts
("--interactive" :: xs) => go xs (record { interactive = True } opts)
("--cg" :: cg :: xs) => go xs (record { codegen = Just cg } opts)
("--only" :: xs) => pure $ record { onlyNames = xs } opts
_ => Nothing
@ -247,7 +250,10 @@ runTest opts testPath
runTest' : IO Bool
runTest'
= do putStr $ testPath ++ ": "
system $ "sh ./run " ++ idris2 opts ++ " | tr -d '\\r' > output"
let cg = case codegen opts of
Nothing => ""
Just cg => "env IDRIS2_TESTS_CG=" ++ cg ++ " "
system $ cg ++ "sh ./run " ++ idris2 opts ++ " | tr -d '\\r' > output"
Right out <- readFile "output"
| Left err => do print err
pure False
@ -299,6 +305,19 @@ findNode
= do Just chez <- getEnv "NODE" | Nothing => pathLookup ["node"]
pure $ Just chez
findRacket : IO (Maybe String)
findRacket
= do Just racket <- getEnv "RACKET" | Nothing => pathLookup ["racket"]
pure $ Just racket
findCG : IO (Maybe String)
findCG
= do Nothing <- getEnv "IDRIS2_CG" | p => pure p
Nothing <- findChez | p => pure (Just "chez")
Nothing <- findNode | p => pure (Just "node")
Nothing <- findRacket | p => pure (Just "racket")
pure Nothing
runChezTests : Options -> List String -> IO (List Bool)
runChezTests opts tests
= do chexec <- findChez
@ -329,6 +348,9 @@ main
let (Just opts) = options args
| _ => do print args
putStrLn usage
opts <- case codegen opts of
Nothing => pure $ record { codegen = !findCG } opts
Just _ => pure opts
let filteredNonCGTests =
filterTests opts $ concat $
[ testPaths "ttimp" ttimpTests