-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test-codegen: replace tempname/open/close/stat by mktemp #23365
Conversation
This seems like a flaky test on Windows [1], FAILURE Error in testset codegen: Test Failed Expression: tempty == true Evaluated: false == true ERROR: LoadError: Test run finished with errors while loading C:\projects\julia\julia-a661736be5\share\julia\test\runtests.jl, in expression starting on line 29 Command exited with code 1 and without being able to reproduce, I'm going to guess it's a race condition betweeen `close` and `stat`. If so, replacing the `stat (2)` syscall by `fstat (2)` may fix it. At the Julia level, that means calling `stat` on the iostream instead. [1]: https://ci.appveyor.com/project/JuliaLang/julia/build/1.0.17932/job/kn10okpwqrbs0126
test/codegen.jl
Outdated
test_jl_dump_compiles_internal(1) | ||
ccall(:jl_dump_compiles, Void, (Ptr{Void},), C_NULL) | ||
|
||
@test stat(io).size == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this changing the sense of the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm you think? Maybe I'm missing something, but it seemed to me the intention is to test what gets written to the io
handle that we pass to :jl_dump_compiles
-- namely, test that nothing gets written (and/or (unlikely but possible) that everything gets truncated after writing). In any case, shouldn't that be the same between calling fstat
on the file handle and calling stat
on the file name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what @tkelman meant is that tempty == false
was equivalent to tstats.size != 0
in the existing code. Now you made it test that this is == 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! I missed that the two test cases were different. Thanks for pointing that out, @nalimilan and @tkelman . In addition, the reason why the test case still passed is that fstat
only gives the correct size after flush
.
Let's see what AppVeyor says.
This fixes two issues: 1. I replaced an `tempty == false` by `size == 0` (should have been `size != 0`) 2. I didn't notice that because I didn't `flush()` before `stat`ing the handle. The second point is ironic, since that's exactly the kind of issue this branch is trying to avoid! See commit message for d7e52d8 for details.
Think this happened on Travis too https://gist.github.com/fredrikekre/ee13a0a48230346343da48e721c0b5c4
|
Subsumed by #23486 ? |
@fredrikekre looks like it! Closing. |
This seems like a flaky test on Windows,
and without being able to reproduce, I'm going to guess it's a race condition betweeen
close
andstat
. If so, replacing thestat (2)
syscall byfstat (2)
may fix it. At the Julia level, that means callingstat
on the iostream instead.