8000 Fix flaky TestSetTraceFunc#test_remove_in_trace by filtering trace events by ono-max · Pull Request #11368 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Fix flaky TestSetTraceFunc#test_remove_in_trace by filtering trace events #11368

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 & 8000 ldquo;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

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

ono-max
Copy link
Member
@ono-max ono-max commented Aug 13, 2024

According to Lauchable, TestSetTraceFunc#test_remove_in_trace is one of flaky tests.

Screenshot 2024-08-13 at 19 39 35

https://app.launchableinc.com/organizations/ruby/workspaces/ruby/data/test-paths/file%3Dtest%2Fruby%2Ftest_settracefunc.rb%23%23%23class%3DTestSetTraceFunc%23%23%23testcase%3Dtest_remove_in_trace?testSessionStatus=fail

Here is the log when failing it.

TestSetTraceFunc#test_remove_in_trace [/home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb:464]:
  [ruby-dev:42350].
  <#<TestSetTraceFunc:0x00007f8afc35fa00
   @__gc_disabled__=false,
   @__io__=nil,
   @__name__=:test_remove_in_trace,
   @__passed__=nil,
   @__runner_options__=
    {:job_status=>nil,
     :retry=>false,
     :hide_skip=>true,
     :failed_output=>#<IO:<STDOUT>>,
     :repeat_count=>nil,
     :excludes=>["../src/test/.excludes"],
     :seed=>16542,
     :ruby=>
      ["./miniruby",
       "-I../src/lib",
       "-I.",
       "-I.ext/common",
       "../src/tool/runruby.rb",
       "--extout=.ext",
       "--",
       "--disable-gems"],
     :filter=>/\A(?=.*)(?!.*(?-mix:memory_leak))/},
   @_assertions=1,
   @original_compile_option=
    {:inline_const_cache=>true,
     :peephole_optimization=>true,
     :tailcall_optimization=>false,
     :specialized_instruction=>true,
     :operands_unification=>true,
     :instructions_unification=>false,
     :debug_frozen_string_literal=>false,
     :coverage_enabled=>true,
     :debug_level=>0,
     :frozen_string_literal=>nil},
   @target_thread=#<Thread:0x00007f8b10d3a7f0 run>,
   @tracepoint_captured_singlethread=false,
   @tracepoint_captured_stat=[[#<RubyVM:0x00007f8b10d3a818>, 0, 0]]>> expected but was
  <#<Tempfile::Closer:0x00007f8af5048df0
   @tmpfile=
    #<File:/tmp/rubytest.0spm3a/parse_include20240813-1425674-kkx1k1.rd (closed)>>>.

Based on investigation, the test was failed when unexpected instance was set in ok variable because unexpected events like Tempfile::Closer was traced. Here is the log when outputting the log. The former event, "e: c-return, f: /home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb..." is expected event, but the latter one is not. Thus, I modified test code so that we can filter out unexpected trace events.

e: c-return, f: /home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb, l: 464, i: set_trace_func, b: , k: Kernel
...
e: call, f: /home/runner/work/ruby/ruby/src/lib/tempfile.rb, l: 371, i: call, b: #<Binding:0xe7eabe28>, k: Tempfile::Closer

https://github.com/ruby/ruby/actions/runs/10365091706/job/28691604883?pr=11323#step:12:19393

@ono-max ono-max marked this pull request as ready for review August 13, 2024 11:21
@mame mame merged commit c06fbb1 into ruby:master Aug 16, 2024
108 checks passed
@ono-max ono-max deleted the fix-flaky-test branch August 16, 2024 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0