The Problem
I'm adding a pre-build script to our TFS build that calls npm install among other things. One package, gulp-imagemin, installs a few dependencies that each run a test when they install that says they've installed successfully. TFS is interpreting this output as an error even though it's actually a success message. It causes my build to "partially succeed".
The unrecognizable characters above are supposed to be a checkmark (I can see it when running locally)...apparently TFS is not a fan, but there are other lines in the output where this happens and it doesn't show an error next to it, so I don't think that's the cause.
Here's where that message comes from:
https://github.com/imagemin/gifsicle-bin/blob/master/lib/install.js#L34
Does anyone know why TFS is interpreting this as an error, or how I can fix this? Thanks much!
What I've Tried
I've tried to silence its output (by redirecting stdout and stderr to $null) to no avail. When running my .ps1 script locally, I can successfully silence that message, but when the script runs in TFS it still gets printed out. I'm not sure what the difference is.
I also tried making my script a .cmd script instead of .ps1 and that had an interesting effect. The silencing I originally intended worked, but then it would effectively skip the step and the remaining pre-build steps. When I removed the output redirect to nul so I could debug, it brought me back to the same error above with no new info.
Related
I am using a powershell script that internally calls msbuild to build my solutions. This works in principle, so the solution files are ok.
I can repeat the build, it works flawlessly.
But the build hangs
the first time I start the script (after reboot)
after some time / actions during the work day, no idea what changes
So my suspicion is, that msbuild is using some component that is not loaded when I reboot / that is unloaded during the work.
But I have no clue how to find the problem...
I am using this exe:
C:\Program Files (x86)\MSBuild\14.0\bin\MsBuild.exe
Any ideas?
For anybody running into this issue: Roslyn does a "shared compilation" by default, which means that results of compiles are used for further compilations to gain speed. You can switch this of by providing "False" for UseSharedCompilation in VBPROJ files or using a similar switch for MsBuild. Switching this off will do slower compiles but the run does not hang.
So here is my issue. I have a prebuild script in TFS2013 that runs JSHint through a gulp command. I want to make the script error if there are any warnings, and I have that working, but the error in the TFS detail is a lot more than the one line I was expecting.
In my powershell script I doing this:
Write-Error "$count files have JSHint warnings"
But here is the error detail in TFS:
Is there any way to make powershell error in a way that will make the build partially succeed/fail with an error detail that does not include all of this extra stuff in it? (You can see that the 2nd error is actually the error from the powershell script.)
I figured it out!
$Host.UI.WriteErrorLine("$count files have JSHint warnings")
This writes a single line to the TFS build details error list without any of the extra detail that throw or Write-Error inject.
So, the key element here is hidden artefacts, also known as those that appear under .teamcity/ part of the build artifacts.
Some context:
We currently run dotCover over our NUnit Test step to report on our test coverage. This places a compilation of the results in a file named CoverageResults.xml under .teamcity/.NETCoverage/. This is the file I would like to accces so we can mine if for some data and send it to a gecko board.
Now, so far, we can successfully get at artifacts not in this part of the directory (such as the result of the build when we output it, etc) using the advised methodology. The problem only occurs when accessing this hidden directory.
The other odd things is the response: a 302 Temporarily Moved.
For reference, my link looks like: (in powershell btw)
"http://{0}:{1}#{2}/guestAuth/repository/download/{3}/.lastFinished/.teamcity/.NETCoverage/CoverageReport.xml" -f $serverURl, $gUName, $gPassword, $buildType
Does anyone have any advice on accessing hidden artifacts? Where else this data could be drawn from (we've found nothing on system variables for this)?
Note: We are already aware that these artifacts are not produced till the build step completes. We are doing this after the fact against a completed build, not during the Build Job itself.
If you add this in the Artifact Paths field it will attach the report as a build artifact once the build has completed
%system.teamcity.build.tempDir%\**\CoverageReport.xml
Hope this helps
Leaving the solution we came up with in case it can be help to anyone else:
In the end, we never got the nitty-gritty of the why but in short, using the in URL authentication with Powershell's Invoke-WebRequest does not work. It appears this is culled from the request created or some such but we went in another direction so I cannot comment much more on this.
What we did do was instead, use cURL. This does not do whatever Powershell does so we simply broke this down into two steps on the Team City Build. A command line step to use cURL to download the file and place it in a temporary directory and the a Powershell step afterwards to get the file and do what we wanted to do.
To do this in-editor you open the automation tab, connect to the session and choose which tests to run.
How do you do it from the command line?
(NB. not compiling UnrealEngine/Engine/Build/BatchFiles/* comprehensively covers both building the application and compiling it. Specifically, given that you have code that is 100% happy to compile, how do you kick the test suite off)
--
Here's some more info, from recent testing on 4.10:
Running tests from the editor:
UE4Editor Project.uproject -ExecCmds="Automation RunTests MyTest"
Notice the absence of the -Game flag; this launches the Editor and runs the tests successfully in the editor console.
Running the game engine and using the 'popup log window':
UE4Editor Project.uproject -Game -ExecCmds="Automation RunTests MyTest" -log
This runs the game in 'play' mode, pops up an editor window; however, the logs stop at:
LogAssetRegistry: FAssetRegistry took 0.0004 seconds to start up
...and the game never closes or executes the tests.
Running the game engine and logging to a file:
UE4Editor Project.uproject -Game -ExecCmds="Automation RunTests MyTest" -log=Log.txt
This runs the game in 'play' mode, and then stops and never exists.
It does not appear to run any tests or log to any files.
The folder Saved/Logs does not exist after quitting the running game.
Running in the editor, test types, etc...
see: https://answers.unrealengine.com/questions/358821/hot-reload-does-not-re-compile-automation-tests.html,
Hot reload is not supported for tests; so this isn't an option.
There's also been some suggestion in various places that the test type (eg. ATF_Game, ATF_Editor) has some affect on if runs are or can be run; perhaps this is an issue to, but I've tried all kind of combinations with no success.
--
I've tried all kinds of combinations of things trying to get this working, with no success so it's time for a bounty.
I'll accept an answer which reliably:
Executes a specific test from the command line
Logs the output from that test to a file
Right, no one has any idea here or on the issue tracker.
After some serious digging through the UE4 source code, here's the actual deal, which I leave here for the next suffering soul who can't figure this out:
To run tests from the command line, and log the output and exit after the test run use:
UE4Editor.exe path/to/project/TestProject.uproject
-ExecCmds="Automation RunTests SourceTests"
-unattended
-nopause
-testexit="Automation Test Queue Empty"
-log=output.txt
-game
On OSX use UE4Editor.app/Contents/MacOS/UE4Editor.
Notice that the logs will, regardless of what you supply, ultimately be placed in:
WindowsNoEditor/TestProject/Saved/Logs/output.txt
or
~/Library/Logs/TestProject/output.txt
Notice that for mac this is outside of your project directory, in, for example, /Users/doug/Library/Logs/TestProject. (Who thought that was a good idea?)
(see https://wiki.unrealengine.com/Locating_Project_Logs#Game_Logs)
You can list automation tests using:
-ExecCmds="Automation List"
...and then parse the response to find tests to run; automation commands may be chained, for example:
-ExecCmds="Automation List, Automation RunAll"
Do you mean the in-editor command line or the Windows command line?
In the editor you can use the Automation command with parameters, e.g. Automation RunAll
In the Windows command line you can specify unreal command parameters with -ExecCmds. To run all tests in your project: UE4Editor.exe YOURPROJECT -Game -ExecCmds="Automation RunAll"
For anyone still wondering, there is a bug in the editor that make it so the test list is flushed before they are run when they are started from the command-line (be it at startup or after).
This means that the editor actually compiles a list of tests to run, which is then flushed by another part of the program. The editor then thinks that it has finished running all the test and, since there is no errors, shows that they all succeeded.
I can post how to do a fix to this if anyone is interested, but it introduce another minor bug.
I have this rakefile that works fine when called from a "Start Command Prompt with Ruby" instance, but fails when called with rake.bat. This means I can't get it to work on Jenkins at all using the Rake build step plugin.
From what I can tell, it's the rake/clean task that's messing up and deleting all files in a "/Core" directory. I've explicitly excluded this from the CLEAN filelist, but when called from rake.bat, this is completely ignored.
What could possibly be the cause for this?
Edit:
OK, more info. CLEAN.exclude('**/core') is ignored the first time it's run in the Ruby shell too, but subsequent runs are fine. That explains why rake.bat is a problem 100% of the time.
I'm using rake 0.8.7, but the same thing happens with 0.9.2. Ruby version is 1.9.2p290. albacore version is 0.2.7. Windows 7 x64 (same thing happens on Windows Server 2008 R2 Standard)
OK, I solved it.
Should've realised it earlier, but it's mind-boggingly weird.
fails the first time: CLEAN.exclude("**/core", "**/bak", "**/~") # a comment here
this always works: CLEAN.exclude("**/core", "**/bak", "**/~")
I guess I'm henceforth removing all comments that are not on a single line in my rakefiles...