I'm having trouble running my tests with NUnit in my Jenkins build. Where the tests all succeed when I run them manually (via a Cake build script) - even directly on the build server -, they fail when run during a build in Jenkins that calls that very same build script.
As output I get the following message:
An error occurred when executing task 'Test'.
Error:
NUnit3: Unrecognised error (exit code -1073740940).
When running NUnit with TraceLevel = TraceLevel.Debug, I get a trace file that looks fine until it simply stops after the same line:
15:49:14.342 Debug [ 6] Dispatcher: Using Direct strategy for <my failing test>
I'm running NUnit with InProcess and a single worker.
It's always the same test failing - but only when run in the CI build.
I get that it's nearly impossible to diagnose the exact problem from here - what I'm asking is for is if there's any way to get any more information on what exactly is failing?
Based on the error code, this seems to be a heap corruption error (C0000374). For more info see https://blogs.msdn.microsoft.com/calvin_hsia/2015/01/30/heap-corruption-exception-0xc0000374/ for some examples of how such an error is generated.
My guess is that your test is doing something bad and getting away with it in most circumstances but that running under Jenkins may change the environment enough so that it throws the exception.
This is very hard to diagnose. First thing I would want to ascertain is whether any of your test code gets executed at all. The NUnit internal trace appears to indicate that the test was dispatched (enqueued) but not actually dequeued and run. However, we sometimes lose a few events when the runner crashes.
You might try running with --workers=0 to see if the simplified execution code (no queues are used) gets you more information.
Related
My question is related to Jenkins and linting errors.
When I run npm run build locally on my machine, I am successfully able to build my code base, without any errors.
However, when I run npm run build on Jenkins, the job FAILS due to linting errors, usually related to case sensitive issues, and varialbes of type any.
Here is an example:
ERROR in {jenkins-path-to-tsx-file}
[tsl] ERROR in {jenkins-path-to-tsx-file}(3,35)
TS2307: Cannot find module './ResetPasswordForm'.
And
ERROR in {jenkins-path-to-tsx-file}
[tsl] ERROR in {jenkins-path-to-tsx-file}(38,29)
TS7006: Parameter 'res' implicitly has an 'any' type.
I understand how to fix these errors in my application code to remove these errors.
My question is, am I able to stop the build failing due to these errors, and display them as warnings, or continue building the Jenkins job despite the errors above?
I have a jenkins build server that is configured to build my iOS project. Recently the build times have greatly increased, going from around 2 min/build to 10 min/build. While watching the console output, I can see that the build keeps getting hung up after the error message:
FATAL: Log statements out of sync: current test case was null
It takes probably a minute for the build to continue running. These messages seem to be occurring after a suit of test cases are run (XCTest framework).
Has anyone seen this console log before? Any help would be greatly appreciated, as I cant seem to find much information online.
My Jenkins Xcode plugin is version 1.4.9, and JUnit plugin is 1.9.
I am getting following exception during automation build execution with Hudson CI. This exception comes after build script completes the build job and because of this exception post build task does not able to get performed. I have tried with with different MAC systems.
FATAL: org.hudsonci.plugins.jna.JnaNativeMacSupport$NativeMacProcess$1StringArrayMemory.getSize()J
java.lang.NoSuchMethodError: org.hudsonci.plugins.jna.JnaNativeMacSupport$NativeMacProcess$1StringArrayMemory.getSize()J
at org.hudsonci.plugins.jna.JnaNativeMacSupport$NativeMacProcess$1StringArrayMemory.hasMore(JnaNativeMacSupport.java:199)
at org.hudsonci.plugins.jna.JnaNativeMacSupport$NativeMacProcess$1StringArrayMemory.readString(JnaNativeMacSupport.java:209)
at org.hudsonci.plugins.jna.JnaNativeMacSupport$NativeMacProcess.parse(JnaNativeMacSupport.java:258)
at org.hudsonci.plugins.jna.JnaNativeMacSupport$NativeMacProcess.getEnvironmentVariables(JnaNativeMacSupport.java:172)
at hudson.util.ProcessTree$Darwin$DarwinProcess.getEnvironmentVariables(ProcessTree.java:962)
at hudson.util.ProcessTree$OSProcess.hasMatchingEnvVars(ProcessTree.java:256)
at hudson.util.ProcessTree$Unix.killAll(ProcessTree.java:504)
at hudson.Launcher$LocalLauncher.kill(Launcher.java:670)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:549)
at hudson.model.Run.run(Run.java:1450)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:82)
at hudson.model.Executor.run(Executor.java:137)
Is there any issue with JNA native access?
Looks to me like jna (whatever that is) can't read some environment variable cause it can't figure out it's size.
I invoke our gtest suite for iOS in Jenkins using the shell script
#!/bin/sh
pkill -a "iPhone Simulator"
ios-sim launch ${WORKSPACE}/source/apple/build/Debug-iphonesimulator/MyAppTest.app --args --gtest_output=xml:${WORKSPACE}/JUnitTestResultsIOS.xml
exit $?
This always successfully runs the tests, and when the tests pass the xml file gets generated as expected. However, when the tests fail, no xml file is generated, and the "Execute shell command" build step terminates but does not fail the job. I echoed the exit code and it comes back 0 even when the tests fail.
This is even more confusing to me since we have a basically identical script in the same job for running tests on our OSX version. This always writes the xml and successfully fails the job when the tests fail.
This behavior seems totally arbitrary and everything about our configuration seems to be exactly as it should be. What am I missing?
Thanks!
There were two things at work here.
First of all, we had the break_on_failure gtest option enabled, which works great when running tests on a local machine but isn't useful within Jenkins, so we disabled it on the build machine.
The second issue was around how we used the exit code. Since ios-sim launch ... always succeeds we were always getting an exit code of 0, regardless of whether the tests passed or failed. I ended up using grep to determine if the resulting xml file indicated any failures, and generated an exit code based on that.
Lately I've been trying to run my spock tests in IntelliJ (which used to work beautifully and had great debugging / specific test re-running on failure features) and in the past few months I've began getting the following error:
| Error Error executing script TestApp:
(class: com/company/MyServiceSpec, method: super$2$oldImpl signature:
(Ljava/lang/Object;)Ljava/lang/Object;)
Illegal use of nonvirtual function call (Use --stacktrace to see the full trace)
It's a spock test that runs just fine from the command line, individually (by specifying the class) or in the entire test-app series. Virtually all of the spock and plain old Unit or Integration tests I have on this project give similar failures in IntelliJ.
I've tried twiddling with the run features of the test (having classpath on or off, running an individual method, a whole test class, or the entire test series) with no luck to remedying the situation. I've also done a grails clean and tried re-running them from IntelliJ : that looked as if it worked once and I was able to run the tests for a little while, but then quickly after doing some work the problem now persists.
I know this is a bit of a vague question, but has anyone seen similar failures and found a reliable remedy? I'm on Grails 2.1 and Spock 0.7, same problem in both IntelliJ 12 and 13
I managed to solve this problem adding the following env variable in my configuration:
_JAVA_OPTIONS='-Xverify:none'
First check your configurations and clear out the test that you have ran that are now failing. It is possible you ran the tests as JUnit and now when you are running them again them they are defaulting this behavior.
Note: You can determine if this the issue by running your tests via the command line (e.g. grails test-app unit com.yourPackage.Whatever) if they pass as expected then follow the steps below to clear your saved test configurations in IntelliJ
IntelliJ Steps
Click Run
Click Edit Configurations
In the left pane of the pop up click the arrow to unroll the jUnit tests
Next Click on a test and then click the minus icon ( do this for each to clear them all )
Go to your test you want to run and right click it and make sure you select the grails choice and not jUnit.