Why unitest for sharpdx fails on Jenkins but not localy and how can i fix it? - unit-testing

I have a couple off UnitTest which are running fine localy, but fail on my Jenkins-Server. All unit-test a failing with an similiar reason: SharpDX is unable to aquire resources.
SetUp : SharpDX.SharpDXException : HRESULT: [0x887A0022], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: A resource is not available at the time of the call. However, it may be available at a later date.
+++++++++++++++++++
STACK TRACE:
at SharpDX.Result.CheckError()
at SharpDX.Direct2D1.Factory.CreateHwndRenderTarget(RenderTargetProperties& renderTargetProperties, HwndRenderTargetProperties& hwndRenderTargetProperties, WindowRenderTarget hwndRenderTarget)
My Jenkins(ver. 2.190.1) is running under the local system account. The error seems to be realted to that (No screen session). I tried the solution from the answers of #maQ at Jenkins on Windows and GUI Tests without RDC and running jenkin as a local user but without success.

Have you tested running your code from command line or from IDE?
If you have not tested your code locally from command line, you can test it.
Is your build node and local machine same? If not please verify that the sharpdx is installed in your build node.
If it is already tested and working and your build node is also configured with the sharpdx, adding the environment variable point to sharpdx home directory in jenkins slave's configuration should work. All the best !

Related

ClassNotFoundException - when building the image & push it to GCR using jib-maven-plugin in BitBucket pipeline

I am getting the below error in my GCP Cloud Run service:
Error: Could not find or load main class com.sdas.demo.sd.Application
Caused by: java.lang.ClassNotFoundException: com.sdas.demo.sd.Application
What I was doing:
I have a spring boot application where I used jib-maven-plugin. In BitBucket pipeline, I was executing the below command:
mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service
After that deploying this GCR image to Cloud Run using gcloud command from BitBucket pipeline. This deployment failed with the error that 'Could not load main class'.
But if I run the mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service from my computer git bash for the same spring boot application code and then deploy it to Cloud Run (via gcloud command or via console or via pipeline); it's deployed successfully.
I used 'mainClass' tag under jib-maven-plugin in pom.xml. But still it is unable to find or load the main class.
Can anyone help how to identify the problem? Is this a classpath issue or environment issue?
Issue sorted now.
Root cause:
'No resources found to compile' - I found this message in the build log. This message remind me something wrong within the application package.
My system is running on Windows 10 and my application directory starting with 'Java.com.demo.sdas' (J in capital). Since Windows is case in sensitive; it is not causing an issue.
BitBucket pipeline running on Linux server and it is case sensitive. Thus it is unable to find the application directory starting with 'Java.com.demo.sdas'.
Solution: Renamed the directory as 'java' and then everything is working as expected.

"No test is available" when attempting to run VSTest for a GoogleTest exe

I have a C++ project that I am attempting to build and run using Azure Pipelines.
The build is working fine but I can't seem to get the unit tests to run in VSTest task using GoogleTest.
It was my understanding Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest is installed (as per https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md) so it can't be that.
Looking at the log I see:
No test is available in D:\a\1\s\Release\UnitTests.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
I also attempted a Command Line Script task but running the UnitTests.exe just yields:
'UnitTests.exe' is not recognized as an internal or external command,
operable program or batch file.
I solved this in the end by installing the Nuget package "GoogleTestAdapter" by Christian Soltenborn. All now seems to work fine but still very puzzled why this workaround is needed

Run CLion Full Remote Mode C++ program as root

I am developing some code using the BlueZ Bluetooth stack and running it requires root privileges. As example running hcitool lescan as normal user returns Set scan parameters failed: Operation not permitted, which is also seen from my C++ code where hci_le_set_scan_parameters() functions returns -1.
The question Run a C++ program in Clion as root is about running C++ program as root in CLion on the local machine, which can be as simple as running the CLion as root.
I have configured Full Remote Mode with remote toolchain:
and then I'm using this same configuration for automatic deployment:
and then the Run/Debug Configurations are automatically run as this user on the remote machine.
I could replace Non-superuser user in Deployment configuration with root and probably solve the problem (by also giving root privileges to whole Remote Host Browser) - but is there any other way to achieve this any only run the built executable with sudo?

Visual Studio Team Services Build cannot deploy test agent

I've got a VSTS build that is trying to deploy a test agent so I can run some Selenium tests and when I get to the "Deploy TestAgent on" build step, I am getting the following error:
2017-06-22T14:29:05.6157972Z ##[warning]Task 'DownloadTestAgent' for
machine vmtest43xxx.cloudapp.net:5986's Error : System.Exception: The
process cannot access the file 'C:\TestAgent\vstf_testagent.exe'
because it is being used by another process.
Also, if setting up a local build agent is a good workaround for this, I'm all ears, but so far I have had a lot of trouble trying to set up a local test agent. This seems weird since setting up a local build agent was relatively easy up to this point. Any suggestions on how I should set up a local agent? I've been trying to follow instructions from here and here.
Thanks!
It’s easy to setup a local build agent, so try to setup a build agent:
Steps for windows:
Go to Admin page of Agent Pools (https://[account].visualstudio.com/_admin/_AgentPool)
Click Download agent button
Unzip the downloaded file
Run Command Line as Administrator
Run config.cmd
Specify collection url (https://[account].visualstudio.com), Personal Access Token etc
More information, you can refer to: Deploy an agent on Windows.
You can specify Test Agent Location (can be access from build agent machine) for Visual Studio Test Agent Deployment task to save time.

Builds are not running after the teamcity instance changed

Hi I am Teamcity Developer.
Now i Have a task to move Teamcity instance to another server.
So far i moved the instance to another one but i am having a problem with running the builds.
You can see below the builds are in incompatible agents.
SNapshot of my builds in Build agent
Please can anyone suggest the way to get builds run on time.
Your JDK does not seems to be recognized.
You should ensure it has been properly installed on every targeted agent.
To visualize your environment settings, you can click on your agent, Agent Parameters and Environment Variable tab.
Inside the C:\BuildAgent\conf\buildAgent.properties file you can declare new variables, like :
env.JDK_18=C:\Program Files (x86)\Java\jdk1.8.xxx\
And, once it has been done, restart your TeamCity Agent Service.