Skip to content

Code coverage does not work with GHUNIT_AUTOEXIT #148

Open
dodikk opened this Issue Jan 23, 2014 · 4 comments

2 participants

@dodikk
dodikk commented Jan 23, 2014
Steps :
  1. Set up coverage flags as described in https://github.com/farcaller/ios-tdd/tree/master/Coverage
  2. Apply the flush() patch https://github.com/leroymattingly/XCode5gcovPatch
  3. Set ghunit environment as shown below and run the application
    setenv("GHUNIT_AUTORUN" , "YES", 1);
    setenv("WRITE_JUNIT_XML", "YES", 1);
    setenv("GHUNIT_AUTOEXIT", "YES", 1);
Acutal result :

Coverage files not generated (CoverStory.app shows nothing)

Expected result :
Coverage files generated successfully in the "build intermediates" directory
@dodikk
dodikk commented Jan 23, 2014

When disabling GHUNIT_AUTOEXIT flag and closing the simulator using the "home button" coverage files are generated just fine

@dodikk
dodikk commented Jan 23, 2014

The patch uses a UIApplicationDidEnterBackgroundNotification notification. https://github.com/leroymattingly/XCode5gcovPatch/blob/master/UIApplication%2BGCovFlush.m

Either the notification should be fired or __gcov_flush() should be invoked on GHUNIT_AUTOEXIT condition.
Implementation approach : https://github.com/pivotal/cedar/search?q=gcov&ref=cmdform

@dodikk
dodikk commented Jan 24, 2014

Fixed in #149
Please merge

@wilsolutions

Hi, pls, I am wondering to know when it will be merged.

tkx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.