Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
556c8a9a
Commit
556c8a9a
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
unix: Fix coverage build now that mp_plat_print uses write.
parent
4300c7db
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
unix/coverage.c
+20
-20
20 additions, 20 deletions
unix/coverage.c
unix/mpconfigport.h
+1
-1
1 addition, 1 deletion
unix/mpconfigport.h
with
21 additions
and
21 deletions
unix/coverage.c
+
20
−
20
View file @
556c8a9a
...
...
@@ -11,7 +11,7 @@
STATIC
mp_obj_t
extra_coverage
(
void
)
{
// mp_printf (used by ports that don't have a native printf)
{
printf
(
"# mp_printf
\n
"
);
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
...
...
@@ -26,67 +26,67 @@ STATIC mp_obj_t extra_coverage(void) {
// vstr
{
printf
(
"# vstr
\n
"
);
mp_
printf
(
&
mp_plat_print
,
"# vstr
\n
"
);
vstr_t
*
vstr
=
vstr_new_size
(
16
);
vstr_hint_size
(
vstr
,
32
);
vstr_add_str
(
vstr
,
"ts"
);
vstr_ins_byte
(
vstr
,
1
,
'e'
);
vstr_ins_char
(
vstr
,
3
,
't'
);
vstr_ins_char
(
vstr
,
10
,
's'
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_cut_head_bytes
(
vstr
,
2
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_cut_tail_bytes
(
vstr
,
10
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_printf
(
vstr
,
"t%cst"
,
'e'
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
vstr_cut_out_bytes
(
vstr
,
3
,
10
);
printf
(
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
vstr
->
len
,
vstr
->
buf
);
VSTR_FIXED
(
fix
,
4
);
vstr_add_str
(
&
fix
,
"large"
);
printf
(
"%.*s
\n
"
,
(
int
)
fix
.
len
,
fix
.
buf
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
fix
.
len
,
fix
.
buf
);
}
// repl autocomplete
{
printf
(
"# repl
\n
"
);
mp_
printf
(
&
mp_plat_print
,
"# repl
\n
"
);
const
char
*
str
;
mp_uint_t
len
=
mp_repl_autocomplete
(
"__n"
,
3
,
&
mp_plat_print
,
&
str
);
printf
(
"%.*s
\n
"
,
(
int
)
len
,
str
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
len
,
str
);
mp_store_global
(
MP_QSTR_sys
,
mp_import_name
(
MP_QSTR_sys
,
mp_const_none
,
MP_OBJ_NEW_SMALL_INT
(
0
)));
mp_repl_autocomplete
(
"sys."
,
4
,
&
mp_plat_print
,
&
str
);
len
=
mp_repl_autocomplete
(
"sys.impl"
,
8
,
&
mp_plat_print
,
&
str
);
printf
(
"%.*s
\n
"
,
(
int
)
len
,
str
);
mp_
printf
(
&
mp_plat_print
,
"%.*s
\n
"
,
(
int
)
len
,
str
);
}
// attrtuple
{
printf
(
"# attrtuple
\n
"
);
mp_
printf
(
&
mp_plat_print
,
"# attrtuple
\n
"
);
static
const
qstr
fields
[]
=
{
MP_QSTR_start
,
MP_QSTR_stop
,
MP_QSTR_step
};
static
const
mp_obj_t
items
[]
=
{
MP_OBJ_NEW_SMALL_INT
(
1
),
MP_OBJ_NEW_SMALL_INT
(
2
),
MP_OBJ_NEW_SMALL_INT
(
3
)};
mp_obj_print_helper
(
&
mp_plat_print
,
mp_obj_new_attrtuple
(
fields
,
3
,
items
),
PRINT_REPR
);
printf
(
"
\n
"
);
mp_
printf
(
&
mp_plat_print
,
"
\n
"
);
}
// str
{
printf
(
"# str
\n
"
);
mp_
printf
(
&
mp_plat_print
,
"# str
\n
"
);
// intern string
printf
(
"%d
\n
"
,
MP_OBJ_IS_QSTR
(
mp_obj_str_intern
(
mp_obj_new_str
(
"intern me"
,
9
,
false
))));
mp_
printf
(
&
mp_plat_print
,
"%d
\n
"
,
MP_OBJ_IS_QSTR
(
mp_obj_str_intern
(
mp_obj_new_str
(
"intern me"
,
9
,
false
))));
}
// mpz
{
printf
(
"# mpz
\n
"
);
mp_
printf
(
&
mp_plat_print
,
"# mpz
\n
"
);
mp_uint_t
value
;
mpz_t
mpz
;
...
...
@@ -94,17 +94,17 @@ STATIC mp_obj_t extra_coverage(void) {
// mpz_as_uint_checked, with success
mpz_set_from_int
(
&
mpz
,
12345678
);
printf
(
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
printf
(
"%d
\n
"
,
(
int
)
value
);
mp_
printf
(
&
mp_plat_print
,
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
mp_
printf
(
&
mp_plat_print
,
"%d
\n
"
,
(
int
)
value
);
// mpz_as_uint_checked, with negative arg
mpz_set_from_int
(
&
mpz
,
-
1
);
printf
(
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
mp_
printf
(
&
mp_plat_print
,
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
// mpz_as_uint_checked, with overflowing arg
mpz_set_from_int
(
&
mpz
,
1
);
mpz_shl_inpl
(
&
mpz
,
&
mpz
,
70
);
printf
(
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
mp_
printf
(
&
mp_plat_print
,
"%d
\n
"
,
mpz_as_uint_checked
(
&
mpz
,
&
value
));
}
return
mp_const_none
;
...
...
This diff is collapsed.
Click to expand it.
unix/mpconfigport.h
+
1
−
1
View file @
556c8a9a
...
...
@@ -192,7 +192,7 @@ void mp_unix_mark_exec(void);
#define MP_PLAT_FREE_EXEC(ptr, size) mp_unix_free_exec(ptr, size)
#include
<unistd.h>
#define MP_PLAT_PRINT_STRN(str, len)
write(1, str, len
)
#define MP_PLAT_PRINT_STRN(str, len)
do { ssize_t ret = write(1, str, len); (void)ret; } while (0
)
#ifdef __linux__
// Can access physical memory using /dev/mem
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment