From 60dc2fefdfe2e311c656a3a3e9c6260f06d889ff Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 24 Dec 2018 00:02:35 +0100 Subject: Nicer output, add CI --- .gitlab-ci.yml | 8 ++++++++ Makefile | 7 +++++-- sjit.icl | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..0f01b0e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +test: + image: "camilstaps/clean:nightly" + before_script: + - install_clean_nightly.sh base lib-platform + - apt-get update -qq + - apt-get install -qq build-essential + script: + - make test diff --git a/Makefile b/Makefile index c4dbdac..4cbd9d9 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ CLM:=clm -CLMFLAGS:=-IL Platform +CLMFLAGS:=-IL Platform -nr -nt BIN:=sjit all: $(BIN) +test: $(BIN) + ./$< + $(BIN): %: %.icl Clean\ System\ Files/sjit_c.o .FORCE $(CLM) $(CLMFLAGS) $@ -o $@ @@ -15,6 +18,6 @@ Clean\ System\ Files/sjit_c.o: sjit_c.c clean: $(RM) -r $(BIN) Clean\ System\ Files -.PHONY: all clean +.PHONY: all test clean .FORCE: diff --git a/sjit.icl b/sjit.icl index e0c1bef..8c86fc1 100644 --- a/sjit.icl +++ b/sjit.icl @@ -3,8 +3,10 @@ module sjit import StdEnv import StdGeneric import StdMaybe + from Data.Func import mapSt, $ from Data.Map import :: Map(..), get, put, newMap, fromList +import System.CommandLine import code from "sjit_c." @@ -169,7 +171,19 @@ where ccall jit "A:I" } -Start = (exec prog, jit prog) +import Text.GenPrint +derive gPrint Instr + +Start w +# (io,w) = stdio w +# io = io <<< "Program: " <<< printToString prog <<< "\n" +# io = io <<< "Interpreted result: " <<< interpreted_result <<< "\n" +# io = io <<< "JIT-compiled result: " <<< jit_compiled_result <<< "\n" +# (_,w) = fclose io w += setReturnCode (if (interpreted_result==jit_compiled_result) 0 1) w +where + interpreted_result = exec prog + jit_compiled_result = jit prog prog =: compile [ {fun_name="id", fun_expr=Abstr ["x"] (Var "x")} -- cgit v1.2.3