开发者

Handling hardware resources when testing with Jenkins

开发者 https://www.devze.com 2023-04-08 18:19 出处:网络
I want to setup Jenkins to 1) pull our source code from our repos开发者_JAVA技巧itory, 2) compile and build it

I want to setup Jenkins to 1) pull our source code from our repos开发者_JAVA技巧itory, 2) compile and build it 3) run the tests on an embedded device

step 1 & 2 are quite easy and straight forward with Jenkins as for step 3, we have hundreds of those devices in various versions of them, and I'm looking for a utility (preferable in python) that can handle the availability of hardware devices/resources.

in such manner that one of the steps will be able to receive which of the device is available and run the tests on it.


What I have found, is that the best thing to do, is have something like jenkins, or if you're using enterprise, electric commander, manage a resource 'pool' the pool is essentially virtual devices, but they have a property, such that you can call into a python script w/ either an ip-address or serial port and communicate w/ your devices.

I used it for automated embedded testing on radios. The python script managed a whole host of tests, and commander would go ahead and choose a single-step resource from the pool, that resource had an ip, and would pass it into the python script. test would then perform all the tests and the stdout would get stored up into commander/jenkins ... Also set properties to track pass/fail count as test was executing

//main resource gets single step item from pool, in the main resource wrote a tiny script that asked if the item pulled from the pool had the resource name == "Bench1" .. "BenchX" etc.

basically:

if resource.name=="BENCH1": python myscript.py --com COM3 --baud 9600 ... etc.

the really great feature about doing it this way, is if you have to disconnect a device, you don't need to deliver up script changes, you simply mark the commander/jenkins resource as disabled, and the main 'project' can still pull from what remains in your resource pool

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号