Mailinglist Archive: yast-devel (47 mails)

< Previous Next >
[yast-devel] Speedup unit tests: parallel_tests gem and parallel Travis jobs

Hi all,

Short version:

Install the latest ruby2.5-rubygem-parallel_tests ruby2.5-rubygem-parallel_tests
packages from YaST:Head OBS and enjoy lightning fast "rake test:unit"
in yast2-storage-ng :-)

(The "devel_yast" pattern has been adapted, running "zypper dup" should be

Long version:

I have spent some time speeding up the unit tests in yast2-storage-ng package.
reason was that running all tests took several minutes, about 3 minutes even on
a quite fast CPU. So after doing even a small change you would have to wait
several minutes to see whether you did not break something by mistake.

The main bottleneck was the sequential start of the tests, so even on a quad
core CPU
only one CPU was actually used.

I have added parallel_test gem [1] support to "rake test:unit" and turned that
on in yast2-storage-ng package. (By default the standard sequential RSpec is
It uses all available CPUs and scales almost linearly, the speed up is about
`nproc` times.

A similar approach I have used in Travis, originally we used license check,
yardoc, unit tests, package build, ... everything sequentially in one Travis
Fortunately Travis supports defining multiple jobs which run independently and
started in parallel.

I have split the Travis work in yast2-storage-ng into three groups: unit tests,
rubocop and the rest (yardoc, package build...).

If you want to use a similar solution in your package then check the
I wrote about this: the Travis [2], the unit tests [3].

Some real numbers to see the improvement:

- Running "rake test:unit" locally: from 2:47s to 0:38s (speedup ~4.3x on a quad
core CPU with HT on)
- Similar speed up in "rake osc:build" (it just additionally prepares the
- OBS package build: from 323s-505s to 102s-235s
(checked several builds, it highly depends on the speed of the worker)
- Travis speed up: from 8-10 minutes to 3-4 minutes (parallel jobs + parallel




Best Regards

Ladislav Slez√°k
Yast Developer
SUSE LINUX, s.r.o. e-mail: lslezak@xxxxxxx
Lihovarsk√° 1060/12 tel: +420 284 028 960
190 00 Prague 9 fax: +420 284 028 951
Czech Republic

To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages