Skip to content

tools/mpremote: Fix test_mount.sh - #19604

Open
hmaerki wants to merge 1 commit into
micropython:masterfrom
hmaerki:fix_mpremote_test_mount
Open

tools/mpremote: Fix test_mount.sh#19604
hmaerki wants to merge 1 commit into
micropython:masterfrom
hmaerki:fix_mpremote_test_mount

Conversation

@hmaerki

@hmaerki hmaerki commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This fixes a failure in mpremote/test_mount.sh.

Obverved error

Somehow the line order in test_mount.sh.exp was out of ordner.

Erroronous test_mount.sh.exp:

x
y
Local directory ${TMP} is mounted at /remote

Fixed test_mount.sh.exp:

Local directory ${TMP} is mounted at /remote
x
y

Rationale

I assume, this happend in

$MPREMOTE mount ${TMP} exec "import mount_package; mount_package.x(); mount_package.y()"

Where mount outputs Local directory ${TMP} is mounted at /remote and exec ouputs x y.

mpremote write to sys.stdout.buffer which caused the false reordering of lines. In this PR, we fix this by flushing the buffer.

Testing

Tested on linux in Octoprobe.

Trade-offs and Alternatives

Generative AI

I did not use generative AI tools when creating this PR.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.58%. Comparing base (7d7ac1c) to head (4fd118f).
⚠️ Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19604      +/-   ##
==========================================
+ Coverage   98.55%   98.58%   +0.03%     
==========================================
  Files         182      182              
  Lines       23320    23322       +2     
  Branches        5        5              
==========================================
+ Hits        22984    22993       +9     
+ Misses        335      328       -7     
  Partials        1        1              
Flag Coverage Δ
unix-coverage-32bit 98.59% <ø> (+0.03%) ⬆️
unix-coverage-64bit 98.52% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Code size report:

Reference:  docs/library/ssl: Mention that PEM certificates are now supported. [817b66b]
Comparison: tools/mpremote: Fix errors while running run-mpremote-tests.sh. [merge of 4fd118f]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@agatti agatti added the tools Relates to tools/ directory in source, or other tooling label Aug 11, 2026
@Josverl
Josverl self-requested a review August 11, 2026 20:41
@hmaerki
hmaerki marked this pull request as draft August 12, 2026 09:06
@hmaerki
hmaerki force-pushed the fix_mpremote_test_mount branch 3 times, most recently from 948d9ea to 5b62dfc Compare August 12, 2026 20:20
Comment thread tools/mpremote/mpremote/transport.py Outdated
@hmaerki

hmaerki commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

test_resume.sh fails for ports/samd ADA_ITSYBITSY_M0:

  • expected

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'a' isn't defined
    
  • effective

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name not defined
    

This seems to be the cause: https://github.com/micropython/micropython/blob/master/py/runtime.c#L255-L259

#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
mp_raise_msg(&mp_type_NameError, MP_ERROR_TEXT("name not defined"));
#else
mp_raise_msg_varg(&mp_type_NameError, MP_ERROR_TEXT("name '%q' isn't defined"), qst);
#endif

@dpgeorge

Copy link
Copy Markdown
Member

test_resume.sh fails for ports/samd ADA_ITSYBITSY_M0:

I suggest fixing that issue like this:

--- a/tools/mpremote/tests/test_resume.sh
+++ b/tools/mpremote/tests/test_resume.sh
@@ -7,7 +7,7 @@ $MPREMOTE exec "a = 'hello'" eval "a"

 # Automatic soft reset. `a` will trigger NameError.
 echo -----
-$MPREMOTE eval "a" || true
+$MPREMOTE eval "'a' in globals()" || true

 # Resume will skip soft reset.
 echo -----
@@ -16,7 +16,7 @@ $MPREMOTE resume eval "a"

 # The eval command will continue the state of the exec.
 echo -----
-$MPREMOTE exec "a = 'soft-reset'" eval "a" soft-reset eval "1+1" eval "a" || true
+$MPREMOTE exec "a = 'soft-reset'" eval "a" soft-reset eval "1+1" eval "'a' in globals()" || true

 # A disconnect will trigger auto-reconnect.
 echo -----

The expected output of that new expression is False.

@hmaerki
hmaerki force-pushed the fix_mpremote_test_mount branch from f4ef9ad to 9a658fc Compare August 13, 2026 09:22
Signed-off-by: Hans Maerki <buhtig.hans.maerki@ergoinfo.ch>
@hmaerki
hmaerki force-pushed the fix_mpremote_test_mount branch from 9a658fc to 4fd118f Compare August 13, 2026 09:29
@hmaerki

hmaerki commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

I was running two jobs against this branch:

All tests now correctly pass or skip.

However:

  • ESP32_S3_DEVKIT is very unstable
  • PYBV11-DP_THREAD once failed

@Josverl: You can review this PR now!

@hmaerki
hmaerki marked this pull request as ready for review August 14, 2026 06:57
@octoprobe-bot

Copy link
Copy Markdown

Octoprobe PR report

Test Tests
passed
Tests
skipped
Tests
xfailed
Tests
failed
run-mpremote-tests.sh 215 16 21
Total 215 16 21
Failures

Group: run-mpremote-tests.sh

Test esp32
0c30-
ESP32_C3_DEVKIT
esp32
5d21-
ESP32_DEVKIT
esp32
472b-
ESP32_S3_DEVKIT
esp32
1830-
LOLIN_C3_MINI
esp8266
7921-
LOLIN_D1_MINI
mimxrt
1133-
TEENSY40
rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
samd
5f2a-
ADA_ITSYBITSY_M0
stm32
2b35-
NUCLEO_WB55
stm32
3a21-
PYBV11
stm32
3a21-
PYBV11-
DP
stm32
7b21-
PYBV11-
DP_THREAD
stm32
3a21-
PYBV11-
THREAD
test_errno.sh pass pass pass pass FAIL pass pass pass pass pass pass pass pass pass pass pass pass pass FAIL pass pass pass pass pass pass pass pass pass
test_resume.sh pass pass pass pass FAIL pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass
test_fs_tree.sh pass pass skip pass skip pass pass pass pass pass pass pass pass pass pass pass pass pass pass FAIL pass pass skip pass pass pass pass pass
test_filesystem.sh pass pass skip pass skip pass FAIL pass FAIL pass pass pass FAIL pass pass pass pass pass pass pass pass pass skip pass pass pass pass pass
test_eval_exec_run.sh pass pass FAIL FAIL FAIL FAIL FAIL pass FAIL pass pass pass FAIL pass pass pass pass pass pass pass pass pass pass pass pass pass pass pass
test_mount.sh pass pass FAIL FAIL FAIL FAIL FAIL pass FAIL pass pass pass FAIL pass pass pass pass pass pass pass pass pass skip pass pass pass pass pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Relates to tools/ directory in source, or other tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants