<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 30, 2013 at 2:18 PM, Andreas Ericsson <span dir="ltr"><<a href="mailto:ae@op5.se" target="_blank">ae@op5.se</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2013-08-29 14:42, Mattias Ryrlén wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
commit f0054ac856059183f6c7bc3f9e8a80<u></u>965a8c0368 (HEAD, master)<br>
Author: Mattias Ryrlén <<a href="mailto:mattiasr@op5.com" target="_blank">mattiasr@op5.com</a>><br>
Date:   Thu Aug 29 14:34:39 2013 +0200<br>
<br>
     YES! test: build on machines with only one cpu<br>
<br>
     There might be someone out there who still have only one cpu/core, let<br>
those<br>
     build too.<br>
<br>
     Signed-off-by: Mattias Ryrlén <<a href="mailto:mattiasr@op5.com" target="_blank">mattiasr@op5.com</a>><br>
<br>
</blockquote>
<br></div>
While I sort of agree that tests should pass on single-cpu machines as<br>
well, this change renders the whole test useless, since we *always*<br>
return > 0 from online_cpus().<br>
<br>
Adding a function (real_online_cpus()) which returns 0 when it can't<br>
reliably test for number of online cpus, and letting that be wrapped<br>
by online_cpus() so that the latter can retain its current behaviour<br>
would solve the problem. online_cpus() should then look like this:<br>
<br>
unsigned int online_cpus(void)<br>
{<br>
        unsigned int cpus = real_online_cpus();<br>
        return cpus ? cpus : 1;<br>
}<br>
<br>
while the new function real_online_cpus() must take the body of the<br>
current online_cpus() function but be changed so that the fallback is<br>
to return 0. The test must then be changed to use real_online_cpus()<br>
instead.<br>
<br>
Would you like to reroll, or should I make the necessary changes and<br>
credit you with an "Reported-by"?</blockquote><div><br></div><div>I reroll, have enough lvl80 chars anyway..</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff --git a/lib/test-nsutils.c b/lib/test-nsutils.c<br>
index 1a23ee1..f835d67 100644<br>
--- a/lib/test-nsutils.c<br>
+++ b/lib/test-nsutils.c<br>
@@ -31,10 +31,10 @@ int main(int argc, char **argv)<br>
         asprintf(&s1, "arg varg foo %d", 12);<br>
         s2 = mkstr("arg varg foo %d", 12);<br>
         ok_str(s1, s2, "mkstr() must build proper strings");<br>
-       if (online_cpus() > 1) {<br>
+       if (online_cpus() > 0) {<br>
                 t_pass("%d online cpus detected", online_cpus());<br>
         } else {<br>
-               t_fail("Do you really have only one cpu core?");<br>
+               t_fail("No online cpus detected");<br>
         }<br>
         return t_end();<br>
  }<br>
<br>
</blockquote>
<br>
<br>
-- <br></div>
Andreas Ericsson                   <a href="mailto:andreas.ericsson@op5.se" target="_blank">andreas.ericsson@op5.se</a><br>
OP5 AB                             <a href="http://www.op5.se" target="_blank">www.op5.se</a><br>
Tel: <a href="tel:%2B46%208-230225" value="+468230225" target="_blank">+46 8-230225</a>                  Fax: <a href="tel:%2B46%208-230231" value="+468230231" target="_blank">+46 8-230231</a><br>
<br>
Considering the successes of the wars on alcohol, poverty, drugs and<br>
terror, I think we should give some serious thought to declaring war<br>
on peace.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Vänliga hälsningar / Best Regards<br>Mattias Ryrlén<br><br>__________________________<br>op5 AB<br>Första Långgatan 19<br>SE-413 27 Göteborg<br>Mobil: +46 735-17 70 99<br>
Support: +46 31-774 09 24<br><a href="http://www.op5.com">www.op5.com</a>
</div></div>