Merge pull request #11319 from miri64/pkg/new/ubasic

pkg: Initial introduction of ubasic package
This commit is contained in:
Juan I Carrano 2019-04-08 17:38:03 +02:00 committed by GitHub
commit 9832299e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 106 additions and 0 deletions

21
pkg/ubasic/Makefile Normal file
View File

@ -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

View File

@ -0,0 +1 @@
INCLUDES += -I$(PKGDIRBASE)/ubasic

6
pkg/ubasic/doc.txt Normal file
View File

@ -0,0 +1,6 @@
/**
* @defgroup pkg_ubasic uBASIC interpreter
* @ingroup pkg
* @brief A really tiny BASIC interpreter
* @see http://dunkels.com/adam/ubasic/
*/

10
pkg/ubasic/ubasic.mk Normal file
View File

@ -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

View File

@ -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

36
tests/pkg_ubasic/Makefile Normal file
View File

@ -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

View File

@ -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))