You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test_trace.rb
    path of file: ./repos/polyphony/test
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

__END__

require_relative 'helper'
require 'polyphony/core/debug'

class TraceTest < MiniTest::Test
  def test_tracing_enabled
    events = [
    
  def test_event_firehose_with_io
    r, w = IO.pipe
    Polyphony::Trace.start_event_firehose(w)

    f1 = spin(:f1) do
      receive
    end

    f1 << :foo
    f1.await

    Thread.backend.trace_proc = nil
    w.close

    log = r.read
    assert_equal 13, log.lines.size

    # TODO: make sure log is formatted correctly
  ensure
    Thread.backend.trace_proc = nil
  end