Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 926785

Summary: cmake.eclass: ctest doesn't accept floating point arguments for --test-load
Product: Gentoo Linux Reporter: Alexander Miller <alex.miller>
Component: EclassesAssignee: Gentoo KDE team <kde>
Status: UNCONFIRMED ---    
Severity: normal CC: base-system
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Alexander Miller 2024-03-11 23:19:46 UTC
In cmake_src_test(), the argument for ctest's --test-load option is obtained
by calling makeopts_loadavg from multiprocessing.eclass. This may result in
a floating point value, but ctest expects an integer. When the user has set
a non-integral value in MAKEOPTS, ctest prints a warning and ignores the
option (i.e., it runs all tests at once if -j is unlimited).

This should be fixed by converting the value to integer.
* The simplest (but incomplete) solution is to strip everything after a
  decimal point.
* A general solution needs proper floating point parsing, and there aren't
  many options without extra dependencies. I think we could use awk, though;
  it's in the system set of the base profile. The following should work
  and be very robust (maybe cange rounding behavior?):
  awk '{print int($1 > 9999 ? 9999 : $1 > 1 ? $1 : 1);}'

Another question is whether the fix should be put right in cmake_src_test
or if it would make sense to provide an integral makeopts_loadavg variant
in multiprocessing.eclass.
Comment 1 Mike Gilbert gentoo-dev 2024-03-13 20:52:55 UTC
Another alternative would be to change ctest to accept a float.