<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body dir="auto"><div dir="auto">Dear LTP community,</div><div dir="auto">
<p class="MsoNormal"><span lang="EN-US">When I run LTP tests with musl libc, I discovered few issues in tst_timer_test.c:<o:p></o:p></span></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span lang="EN-US">The array with run times was not sorted. As Rich Felker pointed out, cmp() function breaks the contract for qsort() – I fixed it.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span lang="EN-US">Because array was not sorted, some tests were dumping cores. Plotting function strongly relies on having array sorted. I fixed that in #1 but still prefer defensive
programming here – protect against buffer overflow i.e. when input data is incorrect.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span lang="EN-US">Calculation if average run time is greater than desired time + threshold was incorrect. Each expected run should be in range t < s[i] < t + threshold, so for max.
edge: sum(s[i] + threshold) < sum(t + threshold). For i belonging to [d,n] => sum(s[i]) < (n-d)*(t + threshold) and not (n-d)*t + threshold.</span></li></ol>
<p class="MsoNormal"><span lang="EN-US">Please add this patch to main line of LTP if you don’t see issues here. Feel free to modify the change if needed.Thanks in advance!</span></p>
<p class="MsoNormal"><span lang="EN-US">Kind regards,</span></p><p class="MsoNormal">Piotr Gawel</p></div>