From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 08A871A60098 for ; Fri, 24 Jun 2016 07:02:03 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 80AD2B5D879 for ; Fri, 24 Jun 2016 07:36:55 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 9622C18CC7B1 for ; Fri, 24 Jun 2016 07:36:55 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4BD141204D7; Fri, 24 Jun 2016 07:36:54 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id B280A120484 for ; Fri, 24 Jun 2016 07:36:50 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=tEbT/D6p5o02WDHVyoThTIsrxwg=; b=RAbYp4JugG/2Yatxtz zkYjvqq6IIYch4lR0OdBIc5Ge+4im63Z+DntIyYt2p7Kxy8YOIdQmpZNVwCc1/Yt PHgH67l9Nlt7CqMMWizLDj/qiND/o6J3d/aGoiYhNzYsI1VYXZHoFijlC3ipbYaC tRI/ZG4m+q/dft5Kf1CPHi1/o= Received: by filter0417p1mdw1.sendgrid.net with SMTP id filter0417p1mdw1.18976.576C647821 2016-06-23 22:36:40.927556829 +0000 UTC Received: from herokuapp.com (ec2-54-87-67-136.compute-1.amazonaws.com [54.87.67.136]) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id UgAhNPh-QBeKkuWy7S5y3g for ; Thu, 23 Jun 2016 22:36:40.755 +0000 (UTC) Date: Thu, 23 Jun 2016 22:36:40 +0000 From: michael@grosser.it To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 50839 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 12480 X-Redmine-Issue-Author: grosser X-Redmine-Issue-Assignee: mame X-Redmine-Sender: grosser X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS73fCckLABeJ8K5yWnmIH2PjNCeePcVIjsBJC 7YsUd41m/aby3tvjp5t702M3MyQRQZLWnO1c5TdMJXkBb/6gWkZW8jsZrD8bYjaFLcU5CPXz5Nnj+k 6cw1LqOaA77OUnYVNc/xV7E+D/vCmABW+hBbW1fZJAlgm7KCivV2PtpdvA== X-SendGrid-Contentd-ID: {"test_id":"1466721403"} X-ML-Name: ruby-core X-Mail-Count: 76122 Subject: [ruby-core:76122] [Ruby trunk Bug#12480] Restarting Coverage does not capture additional coverage for already loaded files X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #12480 has been updated by Michael Grosser. Solved this by using Coverage.peek_result in the before-fork part of my code to capture the current state and then merged it after the fork is done :D Feel free to close this now! ---------------------------------------- Bug #12480: Restarting Coverage does not capture additional coverage for already loaded files https://bugs.ruby-lang.org/issues/12480#change-59326 * Author: Michael Grosser * Status: Feedback * Priority: Normal * Assignee: Yusuke Endoh * ruby -v: 2.3.1 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- I'm trying to combine coverage from before fork and after fork to make coverage reporting work in a forking test runner. The problem I ran into is 2-fold: - A: when forking, previous coverage is lost - B: when restarting coverage, old files do not get added to I could work around issue A by storing the old result and then merging it with the new result post fork, but issue B makes that impossible. Please fix either A or B ... Reproduction steps for A: ~~~ # reproduce.rb require 'coverage' Coverage.start require_relative 'test' a fork do b new = Coverage.result puts "NEW: #{new}" end # test.rb def a 1 end def b 1 end ~~~ NEW: {"/Users/mgrosser/Code/tools/forking_test_runner/test.rb"=>[0, 0, nil, nil, 0, 1, nil]} -> missing coverage information for method `a` Reproduction steps for B: ~~~ # reproduce.rb require 'coverage' Coverage.start require_relative 'test' a old = Coverage.result Coverage.start b new = Coverage.result puts "OLD: #{old} -- NEW: #{new}" # test.rb def a 1 end def b 1 end ~~~ OLD: {"test.rb"=>[1, 1, nil, nil, 1, 0, nil]} -- NEW: {"test.rb"=>[]} -> missing coverage information for method `b` -- https://bugs.ruby-lang.org/