diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile | 3 | ||||
-rw-r--r-- | unix/coverage.c | 11 | ||||
-rw-r--r-- | unix/mpconfigport.h | 6 | ||||
-rw-r--r-- | unix/mpconfigport_coverage.h | 1 | ||||
-rw-r--r-- | unix/mpconfigport_minimal.h | 3 |
5 files changed, 13 insertions, 11 deletions
diff --git a/unix/Makefile b/unix/Makefile index cb9a999f08..956b1daef3 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -157,7 +157,6 @@ endif LIB_SRC_C = $(addprefix lib/,\ $(LIB_SRC_C_EXTRA) \ - utils/printf.c \ timeutils/timeutils.c \ ) @@ -183,7 +182,7 @@ ifneq ($(FROZEN_MPY_DIR),) # then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch). MPY_CROSS = ../mpy-cross/mpy-cross MPY_TOOL = ../tools/mpy-tool.py -FROZEN_MPY_PY_FILES := $(shell find $(FROZEN_MPY_DIR)/ -type f -name '*.py') +FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py') FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool CFLAGS += -DMICROPY_MODULE_FROZEN_MPY diff --git a/unix/coverage.c b/unix/coverage.c index 9d53725543..c84a653f75 100644 --- a/unix/coverage.c +++ b/unix/coverage.c @@ -1,18 +1,22 @@ #include <stdio.h> #include "py/obj.h" +#include "py/objstr.h" #include "py/runtime.h" #include "py/repl.h" #include "py/mpz.h" #if defined(MICROPY_UNIX_COVERAGE) +// str/bytes objects without a valid hash +STATIC const mp_obj_str_t str_no_hash_obj = {{&mp_type_str}, 0, 10, (const byte*)"0123456789"}; +STATIC const mp_obj_str_t bytes_no_hash_obj = {{&mp_type_bytes}, 0, 10, (const byte*)"0123456789"}; + // function to run extra tests for things that can't be checked by scripts STATIC mp_obj_t extra_coverage(void) { // mp_printf (used by ports that don't have a native printf) { mp_printf(&mp_plat_print, "# mp_printf\n"); - mp_printf(&mp_plat_print, "%"); // nothing after percent mp_printf(&mp_plat_print, "%d %+d % d\n", -123, 123, 123); // sign mp_printf(&mp_plat_print, "%05d\n", -123); // negative number with zero padding mp_printf(&mp_plat_print, "%ld\n", 123); // long @@ -21,7 +25,6 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%.*s\n", -1, "abc"); // negative string precision mp_printf(&mp_plat_print, "%b %b\n", 0, 1); // bools mp_printf(&mp_plat_print, "%s\n", NULL); // null string - mp_printf(&mp_plat_print, "%t\n"); // non-format char mp_printf(&mp_plat_print, "%d\n", 0x80000000); // should print signed mp_printf(&mp_plat_print, "%u\n", 0x80000000); // should print unsigned mp_printf(&mp_plat_print, "%x\n", 0x80000000); // should print unsigned @@ -111,7 +114,9 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%d\n", mpz_as_uint_checked(&mpz, &value)); } - return mp_const_none; + // return a tuple of data for testing on the Python side + mp_obj_t items[] = {(mp_obj_t)&str_no_hash_obj, (mp_obj_t)&bytes_no_hash_obj}; + return mp_obj_new_tuple(MP_ARRAY_SIZE(items), items); } MP_DEFINE_CONST_FUN_OBJ_0(extra_coverage_obj, extra_coverage); diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index c449e7316f..56cfaa2ac1 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -117,6 +117,7 @@ #define MICROPY_PY_UHASHLIB_SHA1 (1) #endif #define MICROPY_PY_UBINASCII (1) +#define MICROPY_PY_UBINASCII_CRC32 (1) #define MICROPY_PY_URANDOM (1) #ifndef MICROPY_PY_USELECT #define MICROPY_PY_USELECT (1) @@ -231,9 +232,6 @@ typedef long long mp_off_t; typedef long mp_off_t; #endif -typedef void *machine_ptr_t; // must be of pointer size -typedef const void *machine_const_ptr_t; // must be of pointer size - void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size); void mp_unix_free_exec(void *ptr, mp_uint_t size); void mp_unix_mark_exec(void); @@ -305,5 +303,7 @@ void mp_unix_mark_exec(void); #define _DIRENT_HAVE_D_INO (1) #endif +#ifndef __APPLE__ // For debugging purposes, make printf() available to any source file. #include <stdio.h> +#endif diff --git a/unix/mpconfigport_coverage.h b/unix/mpconfigport_coverage.h index f9a6fbd9dd..5fd5b82c1b 100644 --- a/unix/mpconfigport_coverage.h +++ b/unix/mpconfigport_coverage.h @@ -35,3 +35,4 @@ #undef MICROPY_VFS_FAT #define MICROPY_FSUSERMOUNT (1) #define MICROPY_VFS_FAT (1) +#define MICROPY_PY_FRAMEBUF (1) diff --git a/unix/mpconfigport_minimal.h b/unix/mpconfigport_minimal.h index 054e82c243..15a5f7d852 100644 --- a/unix/mpconfigport_minimal.h +++ b/unix/mpconfigport_minimal.h @@ -135,9 +135,6 @@ typedef long long mp_off_t; typedef long mp_off_t; #endif -typedef void *machine_ptr_t; // must be of pointer size -typedef const void *machine_const_ptr_t; // must be of pointer size - // We need to provide a declaration/definition of alloca() #ifdef __FreeBSD__ #include <stdlib.h> |