From 8543129ba991a2e941d966cc41a610ae594d3fa3 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Mon, 1 Apr 2019 09:00:55 +0200 Subject: [PATCH 1/2] pkg: Initial introduction of ubasic package --- pkg/ubasic/Makefile | 21 +++++++++++++++++++++ pkg/ubasic/Makefile.include | 1 + pkg/ubasic/doc.txt | 6 ++++++ pkg/ubasic/ubasic.mk | 10 ++++++++++ pkg/ubasic/ubasic_tests.mk | 13 +++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 pkg/ubasic/Makefile create mode 100644 pkg/ubasic/Makefile.include create mode 100644 pkg/ubasic/doc.txt create mode 100644 pkg/ubasic/ubasic.mk create mode 100644 pkg/ubasic/ubasic_tests.mk diff --git a/pkg/ubasic/Makefile b/pkg/ubasic/Makefile new file mode 100644 index 0000000000..089d6d36da --- /dev/null +++ b/pkg/ubasic/Makefile @@ -0,0 +1,21 @@ +PKG_NAME=ubasic +PKG_URL=https://github.com/adamdunkels/ubasic +PKG_VERSION=cc07193c231e21ecb418335aba5b199a08d4685c +PKG_LICENSE=BSD-3-Clause + +UBASIC_MODULES = ubasic_tests +UBASIC_USEMODULE = $(filter $(UBASIC_MODULES),$(USEMODULE)) + +.PHONY: all ubasic ubasic% + +all: git-download ubasic + +make_module = "$(MAKE)" -f $(RIOTPKG)/ubasic/$(1).mk -C $(2) + +ubasic: $(UBASIC_USEMODULE) + $(call make_module,$@,$(PKG_BUILDDIR)) + +ubasic%: + $(call make_module,$@,$(PKG_BUILDDIR)) + +include $(RIOTBASE)/pkg/pkg.mk diff --git a/pkg/ubasic/Makefile.include b/pkg/ubasic/Makefile.include new file mode 100644 index 0000000000..57eac2bbb2 --- /dev/null +++ b/pkg/ubasic/Makefile.include @@ -0,0 +1 @@ +INCLUDES += -I$(PKGDIRBASE)/ubasic diff --git a/pkg/ubasic/doc.txt b/pkg/ubasic/doc.txt new file mode 100644 index 0000000000..ed156eb0d7 --- /dev/null +++ b/pkg/ubasic/doc.txt @@ -0,0 +1,6 @@ +/** + * @defgroup pkg_ubasic uBASIC interpreter + * @ingroup pkg + * @brief A really tiny BASIC interpreter + * @see http://dunkels.com/adam/ubasic/ + */ diff --git a/pkg/ubasic/ubasic.mk b/pkg/ubasic/ubasic.mk new file mode 100644 index 0000000000..aeb9dd0dc3 --- /dev/null +++ b/pkg/ubasic/ubasic.mk @@ -0,0 +1,10 @@ +MODULE = ubasic + +# some toolchains complain about the usage of isdigit with a pointer in the +# tokenizer +CFLAGS += -Wno-char-subscripts + +SRC := tokenizer.c ubasic.c +NO_AUTO_SRC := 1 + +include $(RIOTBASE)/Makefile.base diff --git a/pkg/ubasic/ubasic_tests.mk b/pkg/ubasic/ubasic_tests.mk new file mode 100644 index 0000000000..5c4d19d4d1 --- /dev/null +++ b/pkg/ubasic/ubasic_tests.mk @@ -0,0 +1,13 @@ +MODULE = ubasic_tests + +# tests.c has constants that may overflow on <32 bit platforms +CFLAGS += -Wno-overflow +# ubasic_init_peek_poke used in those tests is not exposed +CFLAGS += -Wno-implicit-function-declaration +# LLVM doesn't like ubasic_init_peek_poke due to strict prototyping either +CFLAGS += -Wno-strict-prototypes + +SRC := tests.c +NO_AUTO_SRC := 1 + +include $(RIOTBASE)/Makefile.base From 9f960fd61cb144682c1dd1ef07139c27d9cd07e0 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Mon, 1 Apr 2019 09:01:33 +0200 Subject: [PATCH 2/2] tests: provide tests for ubasic package --- tests/pkg_ubasic/Makefile | 36 ++++++++++++++++++++++++++++++++ tests/pkg_ubasic/tests/01-run.py | 19 +++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/pkg_ubasic/Makefile create mode 100755 tests/pkg_ubasic/tests/01-run.py diff --git a/tests/pkg_ubasic/Makefile b/tests/pkg_ubasic/Makefile new file mode 100644 index 0000000000..71b176fd9e --- /dev/null +++ b/tests/pkg_ubasic/Makefile @@ -0,0 +1,36 @@ +include ../Makefile.tests_common + +BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove + +# msp430-libc does not provide `stdout` variable required by ubasic_tests +# avr-libc does not provide `clock `required by ubasic_tests +# newlib for esp8266 and MIPS does not provide _times_r +BOARD_BLACKLIST := \ + arduino-duemilanove \ + arduino-mega2560 \ + arduino-nano \ + arduino-uno \ + chronos \ + esp8266-esp-12x \ + esp8266-olimex-mod \ + hifive1 \ + jiminy-mega256rfr2 \ + mega-xplained \ + mips-malta \ + msb-430 \ + msb-430h \ + pic32-clicker \ + pic32-wifire \ + telosb \ + waspmote-pro \ + wsn430-v1_3b \ + wsn430-v1_4 \ + z1 \ + # + +TEST_ON_CI_WHITELIST += all + +USEPKG += ubasic +USEMODULE += ubasic_tests + +include $(RIOTBASE)/Makefile.include diff --git a/tests/pkg_ubasic/tests/01-run.py b/tests/pkg_ubasic/tests/01-run.py new file mode 100755 index 0000000000..3dca357bff --- /dev/null +++ b/tests/pkg_ubasic/tests/01-run.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2019 Freie Universität Berlin +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +import sys +from testrunner import run + + +def testfunc(child): + for i in range(1, 6): + child.expect(r"Running test #{}... done. Run time: [0-9.]* s".format(i)) + + +if __name__ == "__main__": + sys.exit(run(testfunc, timeout=120))