summaryrefslogtreecommitdiff
path: root/qemu-arm/test_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-arm/test_main.c')
-rw-r--r--qemu-arm/test_main.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/qemu-arm/test_main.c b/qemu-arm/test_main.c
index ae2beabcd..5c07d1607 100644
--- a/qemu-arm/test_main.c
+++ b/qemu-arm/test_main.c
@@ -1,4 +1,5 @@
#include <stdint.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
@@ -10,7 +11,7 @@
#include "py/runtime.h"
#include "py/stackctrl.h"
#include "py/gc.h"
-#include "py/repl.h"
+#include "py/mperrno.h"
#include "tinytest.h"
#include "tinytest_macros.h"
@@ -23,16 +24,12 @@ inline void do_str(const char *src) {
gc_init(heap, (char*)heap + HEAP_SIZE);
mp_init();
- mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
- if (lex == NULL) {
- tt_abort_msg("Lexer initialization error");
- }
-
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
+ mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT);
- mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, true);
+ mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, false);
mp_call_function_0(module_fun);
nlr_pop();
} else {
@@ -79,7 +76,7 @@ void gc_collect(void) {
}
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
- return NULL;
+ mp_raise_OSError(MP_ENOENT);
}
mp_import_stat_t mp_import_stat(const char *path) {
@@ -92,4 +89,6 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
void nlr_jump_fail(void *val) {
+ printf("uncaught NLR\n");
+ exit(1);
}