[ fix #1043 ] throw error if compileExpr failed (#1052)

Also adding a CI target testing the gambit backend.
This commit is contained in:
G. Allais 2021-02-10 21:10:27 +00:00 committed by GitHub
parent b8aaaf3275
commit 399a2adb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 53 deletions

90
.github/workflows/ci-macos-combined.yml vendored Normal file
View File

@ -0,0 +1,90 @@
name: macOS Combined Chez
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
SCHEME: chez
IDRIS2_TESTS_CG: chez
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
# Building the executable
build-bootstrap-chez:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
brew install chezscheme
brew install coreutils
echo "::add-path::$HOME/.idris2/bin"
- name: Build Idris 2 from bootstrap
run: make bootstrap && make install
shell: bash
- name: Artifact Bootstrapped Idris2
uses: actions/upload-artifact@v2
with:
name: installed-bootstrapped-idris2-chez
path: ~/.idris2/
# self hosting and testing
self-host-chez:
needs: build-bootstrap-chez
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Idris2 Artifact
uses: actions/download-artifact@v2
with:
name: installed-bootstrapped-idris2-chez
path: ~/.idris2/
- name: Install build dependencies
run: |
brew install chezscheme
brew install coreutils
echo "::add-path::$HOME/.idris2/bin"
chmod +x $HOME/.idris2/bin/idris2 $HOME/.idris2/bin/idris2_app/*
- name: Build self-hosted
run: make all && make install
shell: bash
- name: Test self-hosted
run: make test INTERACTIVE=''
shell: bash
# this gambit test is really slow so se run it separately
test-gambit:
needs: build-bootstrap-chez
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Idris2 Artifact
uses: actions/download-artifact@v2
with:
name: installed-bootstrapped-idris2-chez
path: ~/.idris2/
- name: Install build dependencies
run: |
brew install chezscheme
brew install coreutils
brew install gambit-scheme
CURRENTDIR=$(find /usr/local/Cellar/gambit-scheme -type l -name current)
echo "::add-path::${CURRENTDIR}/bin"
echo "::add-path::$HOME/.idris2/bin"
chmod +x $HOME/.idris2/bin/idris2 $HOME/.idris2/bin/idris2_app/*
- name: Test gambit
run: cd tests/gambit/bitops001/ && ./run idris2
shell: bash

View File

@ -1,36 +0,0 @@
name: macOS Chez
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
SCHEME: chez
IDRIS2_TESTS_CG: chez
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build dependencies
run: |
brew install chezscheme
brew install coreutils
echo "::add-path::$HOME/.idris2/bin"
- name: Build Idris 2 from bootstrap
run: make bootstrap && make install && make clean
shell: bash
- name: Build self-hosted
run: make all && make install
shell: bash
- name: Test self-hosted
run: make test INTERACTIVE=''
shell: bash

View File

@ -412,11 +412,10 @@ compileExpr c tmpDir outputDir tm outfile
executeExpr : Ref Ctxt Defs -> (tmpDir : String) -> ClosedTerm -> Core ()
executeExpr c tmpDir tm
= do outn <- compileExpr c tmpDir tmpDir tm "_tmpgambit"
case outn of
-- TODO: on windows, should add exe extension
Just outn => map (const ()) $ coreLift $ system outn
Nothing => pure ()
= do Just sh <- compileExpr c tmpDir tmpDir tm "_tmpgambit"
| Nothing => throw (InternalError "compileExpr returned Nothing")
coreLift $ system sh -- TODO: on windows, should add exe extension
pure ()
export
codegenGambit : Codegen

View File

@ -189,11 +189,6 @@ racketTests = MkTestPool [Racket]
, "futures001"
]
gambitTests : TestPool
gambitTests = MkTestPool [Gambit]
[ "bitops001"
]
nodeTests : TestPool
nodeTests = MkTestPool [Node]
[ "node001", "node002", "node003", "node004", "node005", "node006"
@ -241,7 +236,6 @@ main = runner
, testPaths "chez" chezTests
, testPaths "refc" refcTests
, testPaths "racket" racketTests
, testPaths "gambit" gambitTests
, testPaths "node" nodeTests
, testPaths "templates" templateTests
] where

View File

@ -35,5 +35,3 @@
[4294967284, 11, 10, 9, 15, 0]
[2147483636, 11, 10, 9, 15, 0]
[-2147483638, -11, -12, -9, -15, -2, 2147483637, 10, 11, 9, 0]
1/1: Building BitOps (BitOps.idr)
Main> Main> Bye for now!

View File

@ -1,2 +0,0 @@
:exec main
:q

7
tests/gambit/bitops001/run Normal file → Executable file
View File

@ -1,3 +1,6 @@
$1 --cg gambit --no-banner --no-color --console-width 0 BitOps.idr < input
$1 --cg gambit --exec main BitOps.idr > output
rm -rf build
# We finish with cmp so that the test fails if the comparison fails
diff expected output
cmp expected output