I have a psake task that I run from my build script to verify that the expected artifacts are created in the expected location. It seems to work when I run it from the command line, however it is returning an error code of "-1" when the assert passes or fails. What does exit code -1 mean and why wouldn't I get an exit code of 0 when it passes the assertion?
task VerifyArtifacts {
Assert (Test-Path $package_file) "$package_file could not be found"
}
Command to execute:
psake .\default.ps1 VerifyArtifacts
Related
I have a function that returns nothing, but based on various conditions will exit the process by calling exit(1). So I duly added an EXPECT_EXIT to my test program,
EXPECT_EXIT(checkAndExit(), ::testing::ExitedWithCode(1), ".*");
and when I run it I get this:
Result: died but not with expected exit code:
Exited with exit status 23
Which is interesting, because I most definitely exit(1);
This is on ubuntu 16.04. When I run the same code on osx, it works correctly, it returns 1 and the test passes.
I sifted a bit through the google test source code and nothing popped out at me. Any ideas?
I have this in my build.gradle:
test {
testLogging {
exceptionFormat 'full'
showExceptions true
showStackTraces true
}
}
This works with java ("plain" junit) tests, but when I running scalatest tests, even with -i on command line, all I get in case of a failure is something like this:
com.mypackage.mytests.ScalatestSpec > .apply should fail miserably FAILED
org.scalatest.exceptions.TestFailedException: 2 was not equal to 1
No traceback or even a line number is printed out, and I have to rerun the test manually to be able to see where it actually failed.
Is there another special flag I have to set to get it to stop following my output?
I'm trying to run command line -custom script on Teamcity and getting this error (127):
[02:22:25][Step 1/1] /mnt/teamcity/temp/agentTmp/custom_script8657691082445726475: 1: /mnt/teamcity/temp/agentTmp/custom_script8657691082445726475: ./run.sh: not found
[02:22:25][Step 1/1] Process exited with code 127
[02:22:26][Step 1/1] Step run protractor test (Command Line) failed
any ideas?
It looks like some dependency of your script is not found where it expects it:
./run.sh: not found
Is that the actual script you are running? or is your script trying to call that script?
what solved it was adding 'Agent Requirements' (under build Configuration Settings) saying that 'system.agent.name' equals to the name of the Agent we use.
We have a Scala project and we use SBT as its build tool.
our CI tool is TeamCity, and we build the project using the command line custom script option with the following command:
call %system.SBT_HOME%\bin\sbt clean package
The build process works fine when the build succeeds, however, when compilation fails - TeamCity thinks that the script exited with exitCode 0 and not 1 as expected, this cause TeamCity build to succeed although the compilation failed.
when we run the same commands on local cmd we see that the errorLevel is 1.
the relevant part of the build log:
[11:33:44][Step 1/3] [error] trait ConfigurationDomain JsonSupport extends CommonFormats {
[11:33:44][Step 1/3] [error] ^
[11:33:44][Step 1/3] [error] one error found
[11:33:45][Step 1/3] [error] (compile:compile) Compilation failed
[11:33:45][Step 1/3] [error] Total time: 12 s, completed Jan 9, 2014 11:33:45 AM
[11:33:45][Step 1/3] Process exited with code 0
how can we make TeamCity recognize the failure of the build?
Try explicitly exit with:
call %system.SBT_HOME%\bin\sbt clean package
echo the exit code is %errorlevel%
exit /b
If you can't get the process to output a non-zero exit code then you could use a build failure condition based on specific text in the build log. See this page for the documentation but in essence you can get the build to fail if it finds the text error found in the build log.
I am running msdeploy (in powershell, as part of a script) with a runcommand provider as a postsync step, which runs a batch file on the remote machine. The batch file just executes exit /b 1 which causes it to return a failure code.
I am using msdeploy v3, and have specified successReturnCodes=0 as a provider parameter.
I can see the batch file executing, I can see that msdeploy recognises that it's an error, and logs the fact:
Performing '-postSync'...
Info: Using ID '892ee111-27c1-458d-888d-ead28fcab742' for connections to the remote server.
Info: Using ID '49ee88fc-0e1d-4eff-8a75-bccf0e7d680a' for connections to the remote server.
Info: Updating runCommand (d:\testdeploy\test\test.bat).
Info:
Info: C:\Windows\system32>exit /b 1
Error: (13/06/2013 6:06:03 PM) An error occurred when the request was processed on the remote computer.
Error: The process 'C:\Windows\system32\cmd.exe' (command line '') exited with code '0x1'.
Error count: 1.
Error during '-postSync'.
Total changes: 1 (0 added, 0 deleted, 1 updated, 0 parameters changed, 6 bytes copied)
D:\TestDeploy> $LASTEXITCODE
0
However, msdeploy returns successfully, $LASTEXITCODE is 0.
Is there any way to tell that msdeploy has actually caught an error? (without resorting to capturing the output of msdeploy and checking for the presence of 'Error count:'? :)
It seems that if you remove successReturnsCodes, it will only report as a warnig but msdeploy will return the correct return code.
I'd recommend you file this as a bug on the MSDeploy forums.
It turns out it was due to a mix up in versions between msdeploy v2 and v3. The only combination that will return the exit code correctly is v3 client and v3 service. I was using the v3 client but mistakenly connecting with it to a v2 service.
Richard Szalay is correct, the successReturnCodes just changes the log of the return code from warning to info.