Bug 132286 - run-jsc-stress-tests: Silence warning about kernel interface hw.activecpu not available on Linux
Summary: run-jsc-stress-tests: Silence warning about kernel interface hw.activecpu not...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-28 10:34 PDT by Carlos Alberto Lopez Perez
Modified: 2014-05-03 20:19 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.14 KB, patch)
2014-04-28 10:39 PDT, Carlos Alberto Lopez Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Alberto Lopez Perez 2014-04-28 10:34:12 PDT
When running the run-jsc-stress-tests script, on Linux systems the following warning shows:

sysctl: cannot stat /proc/sys/hw/activecpu: No such file or directory

That kernel interface (hw.activecpu) is not available on Linux. The script gets right the number of CPUs because it fallbacks later to the nproc utility. However the warning about hw.activecpu should be hidden.
Comment 1 Carlos Alberto Lopez Perez 2014-04-28 10:39:08 PDT
Created attachment 230306 [details]
Patch
Comment 2 Darin Adler 2014-04-29 17:37:38 PDT
Comment on attachment 230306 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=230306&action=review

> Tools/Scripts/run-jsc-stress-tests:77
> +    $numProcessors = `sysctl -n hw.activecpu 2>/dev/null`.to_i

I suggest this instead:

    $numProcessors = `sysctl -i -n hw.activecpu`.to_i

That’s much better than hiding all possible errors by routing them to /dev/null.
Comment 3 Carlos Alberto Lopez Perez 2014-04-30 20:16:41 PDT
(In reply to comment #2)
> I suggest this instead:
> 
>     $numProcessors = `sysctl -i -n hw.activecpu`.to_i
> 
> That’s much better than hiding all possible errors by routing them to /dev/null.

The idea of the patch was precisely to hide the stderr output. IMHO there is no point on printing any error that sysctl can give, because in that case, then the current codebase already does another try that uses the system utility nproc. (which is how it gets the number of CPUs on Linux)

Also, your suggestion of passing "-i" don't works on Linux....

If you pass the flag "-i" to sysctl on Linux you will get this:

$ sysctl -i -n hw.activecpu
sysctl: invalid option -- 'i'

Usage:
 sysctl [options] [variable[=value] ...]

Options:
  -a, --all            display all variables
  -A                   alias of -a
  -X                   alias of -a
      --deprecated     include deprecated parameters to listing
  -b, --binary         print value without new line
  -e, --ignore         ignore unknown variables errors
  -N, --names          print variable names without values
  -n, --values         print only values of a variables
  -p, --load[=<file>]  read values from file
  -f                   alias of -p
      --system         read values from all system directories
  -r, --pattern <expression>
                       select setting that match expression
  -q, --quiet          do not echo variable set
  -w, --write          enable writing a value to variable
  -o                   does nothing
  -x                   does nothing
  -d                   alias of -h

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see sysctl(8).



.... which makes the noise even worse
Comment 4 Filip Pizlo 2014-04-30 20:49:23 PDT
Comment on attachment 230306 [details]
Patch

I think this is fine.
Comment 5 WebKit Commit Bot 2014-04-30 21:20:44 PDT
Comment on attachment 230306 [details]
Patch

Clearing flags on attachment: 230306

Committed r168083: <http://trac.webkit.org/changeset/168083>
Comment 6 WebKit Commit Bot 2014-04-30 21:20:48 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Darin Adler 2014-05-03 20:19:00 PDT
I’m fine with the patch we landed, but I don’t agree that we want to hide all error output.

Ideally, we’d want to hide the “I never heard of hw.activecpu before” error, but if there are other types of errors we’d like to see them. Anyway, not a big deal and OK like this.