diff options
author | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2017-03-27 22:05:25 +0300 |
---|---|---|
committer | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2017-03-27 22:05:25 +0300 |
commit | e038ba0c0c80a3aa2a884b08ecc47d479dafecf7 (patch) | |
tree | 0079c198a2e0a00decb0f6ff103ae6e71b147768 | |
parent | 00a76112248652e2fdadeb1336c438d8f8b11050 (diff) |
[tests] Allow to run basic testsuite using "make test".make-test
This will run just quick tests on Linux build so far.
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | scripts/run_tests | 38 |
2 files changed, 41 insertions, 0 deletions
@@ -354,6 +354,9 @@ arcgdb: linux: generate make -f Makefile.linux JS=$(JS) VARIANT=$(VARIANT) CB_STATS=$(CB_STATS) V=$(V) SNAPSHOT=$(SNAPSHOT) +test: + scripts/run_tests + .PHONY: help help: @echo "JavaScript Runtime for Zephyr OS - Build System" diff --git a/scripts/run_tests b/scripts/run_tests new file mode 100755 index 0000000..369d44d --- /dev/null +++ b/scripts/run_tests @@ -0,0 +1,38 @@ +#!/bin/bash + +TESTNUM=0 +START=1 +END=100000 + +# requires: first arg is a <=10-char label, second arg is command +# effects: runs banner with label, then runs the command; if it fails, prints +# label before exiting +function try_command() +{ + TESTNUM=$((TESTNUM + 1)) + if [ "$TESTNUM" -lt "$START" -o "$TESTNUM" -gt "$END" ]; then + echo "Skipping test #$TESTNUM" + return + fi + + LABEL=$1 + shift +# banner "$LABEL" + + # run the command + $* + CODE=$? + if [ $CODE -ne 0 ]; then + echo Error: Failed in $LABEL subtest \#$TESTNUM with code $CODE \(rerun with: trlite $VMNUM $TESTNUM\)! + exit $CODE + fi + echo Success: $LABEL +} + +# linux runtime tests +# TODO: Add buffer, it fails in Linux ATM +for i in error event promise; do + ./outdir/linux/release/jslinux tests/test-$i.js > /tmp/output + cat /tmp/output + try_command "run t-$i" test ! $(grep "FAIL" /tmp/output) +done |