TeamCity, dotCover, and PDBs

So I'm having an interesting delima, and I wanted to know how other people are configuring their TeamCity.


Right now I have one project with two builds: Trunk and Test, their uses are obvious.

However with dotCover, I need PDBs and source code in order for it to work, so Test actually re-checks out all code and recompiles it... while this isn't a huge deal some minor things get changed (version numbers for one).


How do you guys configure you test suites to not have this issue?

24 comments
Comment actions Permalink

Please vote for related issue: http://youtrack.jetbrains.net/issue/TW-18231
There is a workaround added to comment, please give it a try

0
Comment actions Permalink

Entering:

%dep.bt2.teamcity.build.checkoutDir%=>%teamcity.build.checkoutDir%

Makes this happen:

%dep.bt2.teamcity.build.checkoutDir% | Value is required.

As a second configuration parameter inherited from the setup I created.

And it lists no agents available for the build. I copied the bt2 from the links in my dependencies page, TeamCity even recongized it and tried to auto-populate with it.


Local Build Agent 1
Unmet requirements:
dep.bt2.teamcity.build.checkoutDir exists
Local Build Agent 2
Unmet requirements:
dep.bt2.teamcity.build.checkoutDir exists
Local Build Agent 3
Unmet requirements:
dep.bt2.teamcity.build.checkoutDir exists

0
Comment actions Permalink

Hello,

Please sorry for delay.

I checked your case, as it runed out there is an issue in parameters publishing in TeamCity.
Please vote for http://youtrack.jetbrains.net/issue/TW-18715

There is a workaround for it.
Please do the following:
- create a configuration parameter called 'sources' with value '%teamcity.build.checkoutDir'
- use this parameter instead of non-working reference:
    Replace:
%dep.bt2.teamcity.build.checkoutDir%=>%teamcity.build.checkoutDir%
    into:
%dep.bt2.sources%=>%teamcity.build.checkoutDir%

0
Comment actions Permalink

Hi all,

I've added configuration parameters as described, but dotCover still cannot locate the sources. I'm running TeamCity 6.5.1.

I've checked the 'actual parametes on agent' for a unit test run, and it seems to contain the correct source mapping configuration parameter:

dotNetCoverage.dotCover.source.mapping C:\BuildAgent\work\2806d1f90f96878c=>C:\BuildAgent\work\552f10fb78f87d2b


I've also checked that the paths contained in the PDB files all start with C:\BuildAgent\work\2806d1f90f96878c

I've also check that the sources were really checked out to C:\BuildAgent\work\552f10fb78f87d2b during the unit test run.

Has anybody else succesfully used this workaround?

Or am I doing something wrong?

Many thanks!

0
Comment actions Permalink

Please attach the build log after you added the mentioned parameter.

0
Comment actions Permalink

Hi Eugene,

Attached the requested log.

For completeness, I copy-pasted this line from the build.start.properties artifact for the same run:

dotNetCoverage.dotCover.source.mapping=C\:\\BuildAgent\\work\\2806d1f90f96878c\=>C\:\\BuildAgent\\work\\552f10fb78f87d2b

The same line is present in build.finish.properties.


By the way, if I remove the checkout rules on the unit test build configuration (so that the checkoutdir is the same and remapping is not necessary), then dotCover can find the sources just fine.


Thank you,

Arthur.



Attachment(s):
NUnit dotCover with source mapping.log.zip
0
Comment actions Permalink

Please make sure you map checkout sources folder from compiling configuration to sources folder in coverage-running configuration. If you use checkout rules, please check you added necessary suffixes to the left or right part of mapping.
Attach checkout rules of both configuration to check.

0
Comment actions Permalink

Hi Eugene,

> Please make sure you map checkout sources folder from compiling  configuration to sources folder in coverage-running configuration

I have checked this of course. The compiling configuration checks out to C:\BuildAgent\work\2806d1f90f96878c. The coverage-running configuration checks out to C:\BuildAgent\work\552f10fb78f87d2b.

> If you use checkout rules, please check you added necessary suffixes to the left or right part of mapping.

Sorry, I do not understand what you mean.

> Attach checkout rules of both configuration to check.

The compiling configuration has no checkout rules. The coverage-running configuration has these check-out rules:

+:Test

+:source

Note that dotCover can find the sources if I remove the check-out rules from the coverage-running configuration, because then it checks out its sources to C:\BuildAgent\work\2806d1f90f96878c just like the compiling configuration.

Kind regards,

Arthur Hillenaar.

0
Comment actions Permalink

Checkout rule +:source is equivalent to checkout rule +:source=>.
This means, you checkout sources to root folder.
To make mapping work, please add /source to the left part of mapping rule, i.e. C:\BuildAgent\work\2806d1f90f96878c\source=>C:\BuildAgent\work\2806d1f90f96878c

You may simply debug source scrtucture of the configuration by addin a build step that calls a commandline: cmd /c dir /b/s

0
Comment actions Permalink

Eugene,

I don't think that is correct. I ran it again with the checkout rules and this is what I see on the agent:


C:\BuildAgent\work\552f10fb78f87d2b>dir
Volume in drive C has no label.
Volume Serial Number is 6C24-F1B9

Directory of C:\BuildAgent\work\552f10fb78f87d2b

11/10/2011  01:15 PM    <DIR>          .
11/10/2011  01:15 PM    <DIR>          ..
11/10/2011  01:14 PM    <DIR>          source
11/10/2011  01:14 PM    <DIR>          Test
               0 File(s)              0 bytes
               4 Dir(s)  35,186,077,696 bytes free

C:\BuildAgent\work\552f10fb78f87d2b>

Thanks,
Arthur.

0
Comment actions Permalink

I  tried to recreate you configuration.
Please do the following steps:

1. Create a configuration parameter in build configuration that runs compilation of code: 'SourcesBase' value %teamcity.build.checkoutDir%
2. Re-run the build configuratoin to make the property be available
3. In Test+Coverage configuration add configuration parameter 'dotNetCoverage.dotCover.source.mapping' with value '%dep.btXXX.SourcesBase%[source prefix path for compile configuration]=>%teamcity.build.checkoutDir%[sourece prefix path for tests configuraton]' where  btXXX is the build type Id of configuration that runs compilation.

This makes dotCover generate report with sources.

Make sure all full paths from compile configuration are mapped in to existing files of test-running configuration. Left hand of => is tha path of compile configuration and right part of => is the tests-running configuration source file path.

0
Comment actions Permalink

Hi Eugene,

Thanks for looking into this! Unfortunately, still no success :(

I was already using an additional SourceBase configuration parameter with value %teamcity.build.checkoutDir% on the compiling build configuration, like you suggest, only I named it 'checkoutDir'.

To be 100% sure I got the paths right, I updated the checkout rules on the unit test build configuration to:

+:source=>source
+:Test=>Test


And changed the dotNetCoverage.dotCover.source.mapping configuration parameter on the unit test build configuration to:

%dep.bt21.checkoutDir%\source=>%teamcity.build.checkoutDir%\source

When I run the unit test build configuration, this parameter resolves to:

C:\BuildAgent\work\2806d1f90f96878c\source=>C:\BuildAgent\work\552f10fb78f87d2b\source

Using remote desktop, I went in to the respective build agents to see if the sources on the compiling build agent were really in C:\BuildAgent\work\2806d1f90f96878c\source, and the sources on the unit testing build agent were really in C:\BuildAgent\work\552f10fb78f87d2b\source. They were.

There must be something else going on...

Thanks again,
Arthur.

0
Comment actions Permalink

What is the version of TeamCity do you use?

Could you please attach a build log once more.
Please enable agent debug logs are attach them to me.
Take a look to the reporting issues documentation on how to enable aget logging at http://confluence.jetbrains.net/display/TCD7/Viewing+Build+Agent+Logs

0
Comment actions Permalink

Eugene,

TeamCity 6.5.1.

Latest build log for the unittest build configuration attached.

Agent logs with debug info also attached.

Thanks!
Arthur.



Attachment(s):
unittesting-buildagent.logs.zip
NUnit run with dotCover and source mapping 2.log.zip
0
Comment actions Permalink

I found the following lines in the code:

[18:35:58]: Generate dotCover HTML report
[18:35:58]:  [Generate dotCover HTML report] Use sources mapping to map reported by dotCover paths to the build sources:
C:\BuildAgent\work\2806d1f90f96878c\source=>C:\BuildAgent\work\552f10fb78f87d2b\source
[18:35:58]:  [Generate dotCover HTML report] Mapped 0 source file(s).



In build artifacts of the tests-running build configuration you will find file .teamcity/.NETCoverage/CoverageReport.xml (you need to click 'Show' to enable showing of hidden artifacts)

At the end of the file you'll find paths to sources files that dotCover extracted from .pdb files. Please check you have those files check out. Could you please attach this file.

Do you use VB sources?
0
Comment actions Permalink

Yep, this is VB code.

Can I send CoverageReport.xml to you privately?

Here is one line from it:

<File Name="c:\buildagent\work\2806d1f90f96878c\source\chartcenternunittests\testutils.vb" Index="270"/>

This file is indeed checked out on the unit testing build agent:

C:\BuildAgent\work\552f10fb78f87d2b\source\ChartCenterNUnitTests>dir TestUtils.vb
Volume in drive C has no label.
Volume Serial Number is 6C24-F1B9

Directory of C:\BuildAgent\work\552f10fb78f87d2b\source\ChartCenterNUnitTests

11/16/2011  05:53 PM            16,954 TestUtils.vb
               1 File(s)         16,954 bytes
               0 Dir(s)  35,009,310,720 bytes free

C:\BuildAgent\work\552f10fb78f87d2b\source\ChartCenterNUnitTests>

So the source mapping parameter C:\BuildAgent\work\2806d1f90f96878c\source=>C:\BuildAgent\work\552f10fb78f87d2b\source seems correct.

But I get this in the coverage report:

Coverage Summary for Type: TestUtils (ChartCenterNUnitTests)

Type Class, % Method, % Statements, %
TestUtils 100%   (1/ 1) 46.2%   (12/ 26) 49.2%   (60/ 122)



Source code is not available

0
Comment actions Permalink

Hello,

Thank you for report by email. I create a build for you with more detailed logging.
I'll attach the link as the build would be ready.

0
Comment actions Permalink

Please download this build from ftp://ftp.intellij.net/pub/.teamcity/dotCover

This is a 6.5.5+ version of TeamCity.  There I added more logging to understand what went wrong with paths matching.
Please make a try. If error is still reproduces, please enable debugging once more and attach build log and agent debug logs to me.

I ask you to update TeamCity server. Please do not forget to backup server data as described at http://confluence.jetbrains.net/display/TCD65/Upgrade

0
Comment actions Permalink

Eugene,

Thanks for the new build. Still seeing the problem. I've sent requested files again to 'teamcity-feedback@jetbrains.com'.

Regards,
Arthur.

0
Comment actions Permalink

Thank you very much for your logs. I found the issue. As it turned out we checked if reported by dotCover file existed on disk (before matching to mapping rules)
The fix will be available for 6.5.6 or next 7.0 EAP.

I'll attach a build for as it would be ready.

0
Comment actions Permalink

You're welcome, and thanks.

0
Comment actions Permalink

I uploaded new build of TeamCity to the same location, please give it a try

0

Please sign in to leave a comment.