Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
f4c2fe67
Commit
f4c2fe67
authored
Sep 08, 2014
by
Mislav Marohnić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix detecting of CPU cores on FreeBSD
On FreeBSD, use the same approach as OS X with `sysctl`.
parent
bff583b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
+33
-6
bin/ruby-build
+9
-6
test/build.bats
+24
-0
No files found.
bin/ruby-build
View file @
f4c2fe67
...
@@ -115,13 +115,16 @@ file_is_not_empty() {
...
@@ -115,13 +115,16 @@ file_is_not_empty() {
}
}
num_cpu_cores
()
{
num_cpu_cores
()
{
local
num
=
""
local
num
if
[
"Darwin"
=
"
$(
uname
-s
)
"
]
;
then
case
"
$(
uname
-s
)
"
in
Darwin
|
*
BSD
)
num
=
"
$(
sysctl
-n
hw.ncpu 2>/dev/null
||
true
)
"
num
=
"
$(
sysctl
-n
hw.ncpu 2>/dev/null
||
true
)
"
elif
[
-r
/proc/cpuinfo
]
;
then
;;
num
=
"
$(
grep
^processor /proc/cpuinfo | wc
-l
)
"
*
)
[
"
$num
"
-gt
0
]
||
num
=
""
num
=
"
$(
grep
^processor /proc/cpuinfo 2>/dev/null | wc
-l
| xargs
)
"
fi
num
=
"
${
num
#0
}
"
;;
esac
echo
"
${
num
:-
2
}
"
echo
"
${
num
:-
2
}
"
}
}
...
...
test/build.bats
View file @
f4c2fe67
...
@@ -245,6 +245,30 @@ make install
...
@@ -245,6 +245,30 @@ make install
OUT
OUT
}
}
@test "number of CPU cores is detected on FreeBSD" {
cached_tarball "ruby-2.0.0"
stub uname '-s : echo FreeBSD'
stub sysctl '-n hw.ncpu : echo 1'
stub_make_install
export -n MAKE_OPTS
run_inline_definition <<DEF
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
DEF
assert_success
unstub uname
unstub sysctl
unstub make
assert_build_log <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 1
make install
OUT
}
@test "setting RUBY_MAKE_INSTALL_OPTS to a multi-word string" {
@test "setting RUBY_MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "ruby-2.0.0"
cached_tarball "ruby-2.0.0"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment