diff --git a/.github/workflows/ci-api.yml b/.github/workflows/ci-api.yml index ab2f915b8..a73e1f588 100644 --- a/.github/workflows/ci-api.yml +++ b/.github/workflows/ci-api.yml @@ -11,6 +11,8 @@ on: env: SCHEME: scheme + IDRIS2_TESTS_CG: chez + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index b8d2be1d4..23e0cb4d7 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -10,6 +10,8 @@ on: - master env: SCHEME: chez + IDRIS2_TESTS_CG: chez + jobs: build: runs-on: macos-latest diff --git a/.github/workflows/ci-ubuntu-racket.yml b/.github/workflows/ci-ubuntu-racket.yml index 58720c284..a83159439 100644 --- a/.github/workflows/ci-ubuntu-racket.yml +++ b/.github/workflows/ci-ubuntu-racket.yml @@ -9,6 +9,9 @@ on: branches: - master +env: + IDRIS2_TESTS_CG: racket + jobs: build: runs-on: ubuntu-latest @@ -17,9 +20,8 @@ jobs: uses: actions/checkout@v2 - name: Install build dependencies run: | - sudo apt-get update + sudo apt-get update sudo apt-get install -y racket - name: Build from bootstrap run: make bootstrap-racket shell: bash - diff --git a/.github/workflows/ci-ubuntu.yml b/.github/workflows/ci-ubuntu.yml index 0a2934a0d..2464ca57f 100644 --- a/.github/workflows/ci-ubuntu.yml +++ b/.github/workflows/ci-ubuntu.yml @@ -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 - diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index f0942d6ed..dff064c01 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -12,6 +12,7 @@ env: MSYSTEM: MINGW64 MSYS2_PATH_TYPE: inherit SCHEME: scheme + IDRIS2_TESTS_CG: chez CC: gcc jobs: @@ -24,7 +25,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Get Chez Scheme - run: | + run: | git clone --depth 1 https://github.com/cisco/ChezScheme c:\msys64\usr\bin\bash -l -c "pacman -S --noconfirm tar make" echo "::set-env name=PWD::$(c:\msys64\usr\bin\cygpath -u $(pwd))" diff --git a/tests/Main.idr b/tests/Main.idr index 206f241cb..c33ed4160 100644 --- a/tests/Main.idr +++ b/tests/Main.idr @@ -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 [--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