Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
f168e12b
Commit
f168e12b
authored
Mar 10, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1838 from take-cheeze/reduce_mrb_open_in_test
Reduce mrb_open calls in mrbgem test.
parents
93350ca2
77fba204
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
2 deletions
+52
-2
mrbgems/mruby-random/test/random.rb
mrbgems/mruby-random/test/random.rb
+1
-1
tasks/mrbgem_spec.rake
tasks/mrbgem_spec.rake
+4
-0
tasks/mrbgems_test.rake
tasks/mrbgems_test.rake
+40
-0
test/mrbtest.rake
test/mrbtest.rake
+7
-1
No files found.
mrbgems/mruby-random/test/random.rb
View file @
f168e12b
...
...
@@ -73,4 +73,4 @@ assert('Array#shuffle!(random)') do
ary2
.
shuffle!
Random
.
new
345
ary1
!=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
and
10
.
times
{
|
x
|
ary1
.
include?
x
}
and
ary1
==
ary2
end
\ No newline at end of file
end
tasks/mrbgem_spec.rake
View file @
f168e12b
...
...
@@ -43,6 +43,10 @@ module MRuby
MRuby
::
Gem
.
current
=
self
end
def
run_test_in_other_mrb_state?
not
test_preload
.
nil?
or
not
test_objs
.
empty?
end
def
cxx_abi_enabled?
@cxx_abi_enabled
end
...
...
tasks/mrbgems_test.rake
View file @
f168e12b
MRuby
.
each_target
do
no_mrb_open_test_gem
=
[]
gems
.
each
do
|
g
|
unless
g
.
run_test_in_other_mrb_state?
no_mrb_open_test_gem
<<
g
next
end
test_rbobj
=
g
.
test_rbireps
.
ext
(
exts
.
object
)
file
test_rbobj
=>
g
.
test_rbireps
...
...
@@ -100,4 +107,37 @@ MRuby.each_target do
end
end
no_mrb_open_test
=
"
#{
build_dir
}
/test/no_mrb_open_test"
no_mrb_open_test_rbfiles
=
no_mrb_open_test_gem
.
reduce
([])
{
|
res
,
v
|
res
+=
v
.
test_rbfiles
}
file
"
#{
no_mrb_open_test
}
.o"
=>
"
#{
no_mrb_open_test
}
.c"
file
"
#{
no_mrb_open_test
}
.c"
=>
no_mrb_open_test_rbfiles
do
|
t
|
open
(
t
.
name
,
'w'
)
do
|
f
|
f
.
puts
%Q[/*]
f
.
puts
%Q[ * This file contains a test code for following gems:]
no_mrb_open_test_gem
.
each
{
|
g
|
f
.
puts
%Q[ *
#{
g
.
name
}
]
}
f
.
puts
%Q[ *]
f
.
puts
%Q[ * IMPORTANT:]
f
.
puts
%Q[ * This file was generated!]
f
.
puts
%Q[ * All manual changes will get lost.]
f
.
puts
%Q[ */]
f
.
puts
%Q[]
f
.
puts
%Q[
\#
include "mruby.h"]
f
.
puts
%Q[
\#
include "mruby/irep.h"]
f
.
puts
%Q[]
mrbc
.
run
f
,
no_mrb_open_test_rbfiles
,
"no_mrb_open_gem_test_irep"
f
.
puts
%Q[]
f
.
puts
%Q[void no_mrb_open_mrbgem_test(mrb_state *mrb) {]
f
.
puts
%Q[ mrb_load_irep(mrb, no_mrb_open_gem_test_irep);]
f
.
puts
%Q[}]
end
end
end
test/mrbtest.rake
View file @
f168e12b
...
...
@@ -12,9 +12,11 @@ MRuby.each_target do
ass_lib
=
ass_c
.
ext
(
exts
.
object
)
mrbtest_lib
=
libfile
(
"
#{
current_build_dir
}
/mrbtest"
)
file
mrbtest_lib
=>
[
mlib
,
ass_lib
,
gems
.
map
(
&
:test_objs
),
gems
.
map
{
|
g
|
g
.
test_rbireps
.
ext
(
exts
.
object
)
}].
flatten
do
|
t
|
gem_test_files
=
gems
.
select
{
|
g
|
g
.
run_test_in_other_mrb_state?
}.
map
{
|
g
|
g
.
test_rbireps
.
ext
(
exts
.
object
)
}
file
mrbtest_lib
=>
[
mlib
,
ass_lib
,
gems
.
map
(
&
:test_objs
),
gem_test_files
].
flatten
do
|
t
|
archiver
.
run
t
.
name
,
t
.
prerequisites
end
file
mrbtest_lib
=>
"
#{
build_dir
}
/test/no_mrb_open_test.o"
unless
build_mrbtest_lib_only?
driver_obj
=
objfile
(
"
#{
current_build_dir
}
/driver"
)
...
...
@@ -53,12 +55,16 @@ MRuby.each_target do
f
.
puts
IO
.
read
(
init
)
mrbc
.
run
f
,
mrbs
,
'mrbtest_irep'
gems
.
each
do
|
g
|
next
unless
g
.
run_test_in_other_mrb_state?
f
.
puts
%Q[void GENERATED_TMP_mrb_
#{
g
.
funcname
}
_gem_test(mrb_state *mrb);]
end
f
.
puts
%Q[void no_mrb_open_mrbgem_test(mrb_state *mrb);]
f
.
puts
%Q[void mrbgemtest_init(mrb_state* mrb) {]
gems
.
each
do
|
g
|
next
unless
g
.
run_test_in_other_mrb_state?
f
.
puts
%Q[ GENERATED_TMP_mrb_
#{
g
.
funcname
}
_gem_test(mrb);]
end
f
.
puts
%Q[ no_mrb_open_mrbgem_test(mrb);]
f
.
puts
%Q[}]
end
end
...
...
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