Skip to content

Commit ddf64bf

Browse files
committed
Minor changes to uf2create provider for running test
Make the logging of the uf2create provider more verbose when running under tests so output can be parsed and verified with expected results. Signed-off-by: Winford <winford@object.stream>
1 parent 88143e3 commit ddf64bf

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/atomvm_uf2create_provider.erl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ do(State) ->
7979
StartAddrStr = parse_addr(maps:get(start, Opts)),
8080
Image = maps:get(input, Opts, TargetAVM),
8181
Uf2Flavor = validate_flavor(maps:get(family_id, Opts)),
82-
ok = uf2tool:uf2create(Output, Uf2Flavor, StartAddrStr, Image),
82+
ok = do_create_uf2(Output, Uf2Flavor, StartAddrStr, Image),
83+
rebar_api:info("UF2 file written to ~s", [Output]),
8384
{ok, State}
8485
catch
8586
C:E:S ->
@@ -99,6 +100,19 @@ format_error(Reason) ->
99100
%% internal functions
100101
%%
101102

103+
%% @private
104+
do_create_uf2(Output, Uf2Flavor, StartAddrStr, Image) ->
105+
case os:getenv("ATOMVM_REBAR3_TEST_MODE") of
106+
"true" ->
107+
rebar_api:info(
108+
"Using uf2create options:~n --output ~s~n --family_id ~p~n --start 0x~.16B~n --input ~s",
109+
[Output, Uf2Flavor, StartAddrStr, Image]
110+
);
111+
_ ->
112+
ok
113+
end,
114+
uf2tool:uf2create(Output, Uf2Flavor, StartAddrStr, Image).
115+
102116
%% @private
103117
get_opts(State) ->
104118
{ParsedArgs, _} = rebar_state:command_parsed_args(State),

test/run.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ unset ATOMVM_REBAR3_PLUGIN_PICO_RESET_DEV
2424

2525
unset ATOMVM_REBAR3_PLUGIN_UF2CREATE_START
2626

27+
export ATOMVM_REBAR3_TEST_MODE="true"
28+
2729
cd "${test_dir}"
2830
rebar3 escriptize
2931
./_build/default/bin/driver -r "$(pwd)" "$@"
32+
33+
unset ATOMVM_REBAR3_TEST_MODE

0 commit comments

Comments
 (0)