stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

#862 Fix flaky loadtxt test for int32 by adding sleep after savetxt. .

Open punithk-verse opened this issue 1 month ago • 3 comments

Added sleep calls to test_loadtxt.f90 to introduce delays between file operations. because before file was being read even before it was writeen and closed

Fixes #862

This PR addresses the intermittent failure of the loadtxt test for int32, which occasionally produced:

  • Fortran runtime error: Bad value during floating point read End-of-file during read

Root cause: The test wrote data to 'test_int32.txt' and immediately attempted to read it with loadtxt. Fix: After every call to savetxt, a short delay has been added: call sleep(1) This ensures the file is fully written and stable before loadtxt reads it. This is a beginner-friendly first fix; maintainers may later improve it using proper file flushing.

punithk-verse avatar Nov 16 '25 14:11 punithk-verse

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 25.13%. Comparing base (fffe0d7) to head (475ea9f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1057      +/-   ##
==========================================
+ Coverage   25.12%   25.13%   +0.01%     
==========================================
  Files         570      570              
  Lines      234201   234201              
  Branches    41277    41276       -1     
==========================================
+ Hits        58838    58871      +33     
+ Misses     175363   175330      -33     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 16 '25 18:11 codecov[bot]

Because the change only affects test routines, and the ongoing onstability of said tests, I am in favor of the PR proposal, although it's not great coding practice. @jvdp1 what do you think?

perazz avatar Nov 24 '25 11:11 perazz

Thank you @punithk-verse for this PR.

Because the change only affects test routines, and the ongoing onstability of said tests, I am in favor of the PR proposal, although it's not great coding practice. @jvdp1 what do you think?

I puzzled with this PR. There are some issues indeed, but I am afraid that this PR will just hide them. Could the intrinsic flush be used instead of sleep?

jvdp1 avatar Nov 29 '25 14:11 jvdp1