From bd621e95f496a5cd40ca75548f32c063212b8987 Mon Sep 17 00:00:00 2001 From: acondolu Date: Tue, 11 Jul 2017 15:42:09 +0200 Subject: [PATCH] Run tests with: make run --- ocaml/Makefile | 7 ++++++- ocaml/run | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ocaml/run diff --git a/ocaml/Makefile b/ocaml/Makefile index b4b12e0..46242b1 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -5,6 +5,11 @@ UTILS = parser.cmx console.cmx listx.cmx util.cmx pure.cmx num.cmx all: a.out test4.out # test.out +run: FORCE test4.out + bash run + +FORCE: + a.out: $(UTILS) lambda4.cmx problems.cmx $(OCAMLC) -o a.out $(LIB) $^ @@ -28,4 +33,4 @@ clean: include .depend -.PHONY: clean all +.PHONY: clean all run diff --git a/ocaml/run b/ocaml/run new file mode 100644 index 0000000..7a6436d --- /dev/null +++ b/ocaml/run @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +file=`mktemp` + +echo +echo "Running test. Log file: $file." +echo + +trap 'echo' SIGINT + +if ( ./test4.out 2>&1 | tee $file | stdbuf -o0 grep -Po '(?<=measure=)[^ ]*' | stdbuf -o0 tr '\n' ' ') +then { + rm $file + echo + echo 'Test succeeded' +} +else { + echo '' + echo 'Test failed or interrupted' + echo "Please have a look at log file: $file ." +} +fi -- 2.39.2