PDA

View Full Version : Files locked by NUnit console


teognost
03-07-2008, 02:13 PM
We are doing a couple of intraday builds.During the build unit tests are performed using nunit console but launched from NCover(in order to create coverage reports as well):
"C:\Program Files\NCover\NCover.Console.exe" "C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe" "ConfigMgrTests.dll" //w D:\LatestUnitTestBinaries\IntradayTrunk //a ConfigMgr //ea TranslatorGen.GeneratedTranslatorAttribute;Seriali zation.GeneratedSerializatorAttribute //l D:\Reports\NCover\2008.0307.1.0\ConfigMgrTests.dll .Coverage.log //x D:\Reports\NCover\2008.0307.1.0\ConfigMgrTests.dll .Coverage.xml /noshadow /xml:"D:\Reports\UnitTests\2008.0307.1.0\ConfigMgrTests. dll.xml"

The command is run for all the dlls,one by one.
But after build finished-some dlls remained locked,cannot delete them so next intraday build would fail.
In Task Manager it appears the process nunit-console.exe even after build is finished.
If I kill this process manually-files are not locked anymore.
I am thinking about doing this automatically at the end of each build-determine the process ID of nunit-console.exe launched by current build and kill it.
I need to kill specific ID as it can run in the same time a branch build and I do not want to kill its nunit-console.exe which is still running...
Is there any way to do this in VBuild?
Or is there a way to kill all the processes launched inside the build process as soon as build is finished?
The build is launched with VisBuildCmd.exe.

kinook
03-07-2008, 02:26 PM
You may want to open an issue with the NCover and/or NUnit vendor -- it sounds like a bug if the process doesn't exit after it has completed its task.

As far as working around the problem, once you obtain the process ID (not sure of the best way to determine which one if there are multiple), you can use the Kill Process action to kill it: http://www.visualbuild.com/Manual/killprocessaction.htm

teognost
03-07-2008, 02:36 PM
Ok,so this could be a workaround if I do not get any solution from NUnit\NCover.
But I do not know how to determine the process ID.
I use for launching NUnit\NCover ->a NCover action.

teognost
03-11-2008, 04:23 AM
Finally I used this workaround:
-I implemented a step calling Unlocker.exe (http://www.emptyloop.com/unlocker/) in command line with -s -o parameters.Normally this program should unlock the related folder but in my case it does not happen but it writes in a log file the process id that keeps the folder locked.Log file is located in the same folder with Unlocker.exe
-I implemented a VBScript step that would read from the log the process id
-I implemented a kill process step for the process id deterrminated in previous step.