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
c6aa87c8
Commit
c6aa87c8
authored
Sep 03, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2924 from zzak/mruby-test
Extract mrbtest to binary gem
parents
e35c3aff
87564dc9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
113 additions
and
83 deletions
+113
-83
Rakefile
Rakefile
+4
-5
build_config.rb
build_config.rb
+10
-0
mrbgems/full-core.gembox
mrbgems/full-core.gembox
+1
-1
mrbgems/mruby-test/README.md
mrbgems/mruby-test/README.md
+0
-0
mrbgems/mruby-test/driver.c
mrbgems/mruby-test/driver.c
+0
-0
mrbgems/mruby-test/init_mrbtest.c
mrbgems/mruby-test/init_mrbtest.c
+0
-0
mrbgems/mruby-test/mrbgem.rake
mrbgems/mruby-test/mrbgem.rake
+85
-5
tasks/mruby_build.rake
tasks/mruby_build.rake
+1
-1
test/mrbtest.rake
test/mrbtest.rake
+0
-69
test/t/syntax.rb
test/t/syntax.rb
+2
-2
travis_config.rb
travis_config.rb
+10
-0
No files found.
Rakefile
View file @
c6aa87c8
...
...
@@ -26,9 +26,6 @@ load "#{MRUBY_ROOT}/mrblib/mrblib.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/mrbgems.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/libmruby.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/mrbgems_test.rake"
load
"
#{
MRUBY_ROOT
}
/test/mrbtest.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/benchmark.rake"
##############################
...
...
@@ -117,9 +114,11 @@ task :all => depfiles do
end
desc
"run all mruby tests"
task
:test
=>
[
"all"
]
+
MRuby
.
targets
.
values
.
map
{
|
t
|
t
.
build_mrbtest_lib_only?
?
t
.
libfile
(
"
#{
t
.
build_dir
}
/test/mrbtest"
)
:
t
.
exefile
(
"
#{
t
.
build_dir
}
/test/mrbtest"
)
}
do
task
:test
=>
[
"all"
]
do
MRuby
.
each_target
do
run_test
unless
build_mrbtest_lib_only?
if
gems
.
find
{
|
v
|
v
.
name
==
'mruby-test'
}
run_test
unless
build_mrbtest_lib_only?
end
end
end
...
...
build_config.rb
View file @
c6aa87c8
...
...
@@ -108,6 +108,16 @@ MRuby::Build.new('host-debug') do |conf|
# conf.enable_bintest
end
MRuby
::
Build
.
new
(
'test'
)
do
|
conf
|
toolchain
:gcc
enable_debug
conf
.
enable_bintest
conf
.
gembox
'default'
conf
.
gem
:core
=>
"mruby-test"
end
# Define cross build settings
# MRuby::CrossBuild.new('32bit') do |conf|
# toolchain :gcc
...
...
mrbgems/full-core.gembox
View file @
c6aa87c8
...
...
@@ -4,6 +4,6 @@ MRuby::GemBox.new do |conf|
Dir.glob("#{root}/mrbgems/mruby-*/mrbgem.rake") do |x|
g = File.basename File.dirname x
conf.gem :core => g unless g =~ /^mruby-(print|sprintf|bin-debugger)$/
conf.gem :core => g unless g =~ /^mruby-(print|sprintf|bin-debugger
|test
)$/
end
end
test/README.md
→
mrbgems/mruby-
test/README.md
View file @
c6aa87c8
File moved
test/driver.c
→
mrbgems/mruby-
test/driver.c
View file @
c6aa87c8
File moved
test/init_mrbtest.c
→
mrbgems/mruby-
test/init_mrbtest.c
View file @
c6aa87c8
File moved
tasks/mrbgems_test
.rake
→
mrbgems/mruby-test/mrbgem
.rake
View file @
c6aa87c8
MRuby
.
each_target
do
gem_table
=
gems
.
generate_gem_table
self
MRuby
::
Gem
::
Specification
.
new
(
'mruby-test'
)
do
|
spec
|
spec
.
license
=
'MIT'
spec
.
author
=
'mruby developers'
spec
.
summary
=
'mruby test'
gems
.
each
do
|
g
|
build
.
bins
<<
'mrbtest'
spec
.
add_dependency
(
'mruby-compiler'
,
:core
=>
'mruby-compiler'
)
clib
=
"
#{
build_dir
}
/mrbtest.c"
mlib
=
clib
.
ext
(
exts
.
object
)
mrbs
=
Dir
.
glob
(
"
#{
MRUBY_ROOT
}
/test/t/*.rb"
)
exec
=
exefile
(
"
#{
build
.
build_dir
}
/bin/mrbtest"
)
libmruby
=
libfile
(
"
#{
build
.
build_dir
}
/lib/libmruby"
)
libmruby_core
=
libfile
(
"
#{
build
.
build_dir
}
/lib/libmruby_core"
)
mrbtest_lib
=
libfile
(
"
#{
build_dir
}
/mrbtest"
)
mrbtest_objs
=
[]
driver_obj
=
objfile
(
"
#{
build_dir
}
/driver"
)
driver
=
"
#{
spec
.
dir
}
/driver.c"
assert_c
=
"
#{
build_dir
}
/assert.c"
assert_rb
=
"
#{
MRUBY_ROOT
}
/test/assert.rb"
assert_lib
=
assert_c
.
ext
(
exts
.
object
)
mrbtest_objs
<<
assert_lib
file
assert_lib
=>
assert_c
file
assert_c
=>
[
build
.
mrbcfile
,
assert_rb
]
do
|
t
|
open
(
t
.
name
,
'w'
)
do
|
f
|
mrbc
.
run
f
,
assert_rb
,
'mrbtest_assert_irep'
end
end
gem_table
=
build
.
gems
.
generate_gem_table
self
build
.
gems
.
each
do
|
g
|
test_rbobj
=
g
.
test_rbireps
.
ext
(
exts
.
object
)
g
.
test_objs
<<
test_rbobj
dep_list
=
gems
.
tsort_dependencies
(
g
.
test_dependencies
,
gem_table
).
select
(
&
:generate_functions
)
dep_list
=
build
.
gems
.
tsort_dependencies
(
g
.
test_dependencies
,
gem_table
).
select
(
&
:generate_functions
)
file
test_rbobj
=>
g
.
test_rbireps
file
g
.
test_rbireps
=>
[
g
.
test_rbfiles
].
flatten
+
[
File
.
join
(
g
.
dir
,
'mrbgem.rake'
),
g
.
build
.
mrbcfile
,
__FILE__
,
"
#{
MRUBY_ROOT
}
/tasks/mrbgem_spec.rake"
]
do
|
t
|
file
g
.
test_rbireps
=>
[
g
.
test_rbfiles
].
flatten
+
[
File
.
join
(
g
.
dir
,
'mrbgem.rake'
),
g
.
build
.
mrbcfile
,
"
#{
MRUBY_ROOT
}
/tasks/mrbgem_spec.rake"
]
do
|
t
|
FileUtils
.
mkdir_p
File
.
dirname
(
t
.
name
)
open
(
t
.
name
,
'w'
)
do
|
f
|
g
.
print_gem_test_header
(
f
)
...
...
@@ -91,4 +124,51 @@ MRuby.each_target do
end
end
end
build
.
gems
.
each
do
|
v
|
mrbtest_objs
.
concat
v
.
test_objs
end
file
mrbtest_lib
=>
mrbtest_objs
do
|
t
|
build
.
archiver
.
run
t
.
name
,
t
.
prerequisites
end
unless
build
.
build_mrbtest_lib_only?
file
exec
=>
[
driver_obj
,
mlib
,
mrbtest_lib
,
libmruby_core
,
libmruby
]
do
|
t
|
gem_flags
=
build
.
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
gem_flags_before_libraries
=
build
.
gems
.
map
{
|
g
|
g
.
linker
.
flags_before_libraries
}
gem_flags_after_libraries
=
build
.
gems
.
map
{
|
g
|
g
.
linker
.
flags_after_libraries
}
gem_libraries
=
build
.
gems
.
map
{
|
g
|
g
.
linker
.
libraries
}
gem_library_paths
=
build
.
gems
.
map
{
|
g
|
g
.
linker
.
library_paths
}
build
.
linker
.
run
t
.
name
,
t
.
prerequisites
,
gem_libraries
,
gem_library_paths
,
gem_flags
,
gem_flags_before_libraries
end
end
init
=
"
#{
spec
.
dir
}
/init_mrbtest.c"
file
mlib
=>
clib
file
clib
=>
[
build
.
mrbcfile
,
init
]
do
|
t
|
_pp
"GEN"
,
"*.rb"
,
"
#{
clib
.
relative_path
}
"
FileUtils
.
mkdir_p
File
.
dirname
(
clib
)
open
(
clib
,
'w'
)
do
|
f
|
f
.
puts
%Q[/*]
f
.
puts
%Q[ * This file contains a list of all]
f
.
puts
%Q[ * test functions.]
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
IO
.
read
(
init
)
mrbc
.
run
f
,
mrbs
,
'mrbtest_irep'
build
.
gems
.
each
do
|
g
|
f
.
puts
%Q[void GENERATED_TMP_mrb_
#{
g
.
funcname
}
_gem_test(mrb_state *mrb);]
end
f
.
puts
%Q[void mrbgemtest_init(mrb_state* mrb) {]
build
.
gems
.
each
do
|
g
|
f
.
puts
%Q[ GENERATED_TMP_mrb_
#{
g
.
funcname
}
_gem_test(mrb);]
end
f
.
puts
%Q[}]
end
end
end
tasks/mruby_build.rake
View file @
c6aa87c8
...
...
@@ -249,7 +249,7 @@ EOS
def
run_test
puts
">>> Test
#{
name
}
<<<"
mrbtest
=
exefile
(
"
#{
build_dir
}
/
test
/mrbtest"
)
mrbtest
=
exefile
(
"
#{
build_dir
}
/
bin
/mrbtest"
)
sh
"
#{
filename
mrbtest
.
relative_path
}#{
$verbose
?
' -v'
:
''
}
"
puts
run_bintest
if
@enable_bintest
...
...
test/mrbtest.rake
deleted
100644 → 0
View file @
e35c3aff
MRuby
.
each_target
do
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
exec
=
exefile
(
"
#{
current_build_dir
}
/mrbtest"
)
clib
=
"
#{
current_build_dir
}
/mrbtest.c"
mlib
=
clib
.
ext
(
exts
.
object
)
mrbs
=
Dir
.
glob
(
"
#{
current_dir
}
/t/*.rb"
)
init
=
"
#{
current_dir
}
/init_mrbtest.c"
ass_c
=
"
#{
current_build_dir
}
/assert.c"
ass_lib
=
ass_c
.
ext
(
exts
.
object
)
mrbtest_lib
=
libfile
(
"
#{
current_build_dir
}
/mrbtest"
)
mrbtest_objs
=
[
mlib
,
ass_lib
]
gems
.
each
do
|
v
|
mrbtest_objs
.
concat
v
.
test_objs
end
file
mrbtest_lib
=>
mrbtest_objs
do
|
t
|
archiver
.
run
t
.
name
,
t
.
prerequisites
end
unless
build_mrbtest_lib_only?
driver_obj
=
objfile
(
"
#{
current_build_dir
}
/driver"
)
file
exec
=>
[
driver_obj
,
mrbtest_lib
,
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
gem_flags_before_libraries
=
gems
.
map
{
|
g
|
g
.
linker
.
flags_before_libraries
}
gem_flags_after_libraries
=
gems
.
map
{
|
g
|
g
.
linker
.
flags_after_libraries
}
gem_libraries
=
gems
.
map
{
|
g
|
g
.
linker
.
libraries
}
gem_library_paths
=
gems
.
map
{
|
g
|
g
.
linker
.
library_paths
}
linker
.
run
t
.
name
,
t
.
prerequisites
,
gem_libraries
,
gem_library_paths
,
gem_flags
,
gem_flags_before_libraries
end
end
file
ass_lib
=>
ass_c
file
ass_c
=>
[
"
#{
current_dir
}
/assert.rb"
,
__FILE__
]
do
|
t
|
FileUtils
.
mkdir_p
File
.
dirname
t
.
name
open
(
t
.
name
,
'w'
)
do
|
f
|
mrbc
.
run
f
,
[
t
.
prerequisites
.
first
],
'mrbtest_assert_irep'
end
end
file
mlib
=>
clib
file
clib
=>
[
mrbcfile
,
init
,
__FILE__
]
+
mrbs
do
|
t
|
_pp
"GEN"
,
"*.rb"
,
"
#{
clib
.
relative_path
}
"
FileUtils
.
mkdir_p
File
.
dirname
(
clib
)
open
(
clib
,
'w'
)
do
|
f
|
f
.
puts
%Q[/*]
f
.
puts
%Q[ * This file contains a list of all]
f
.
puts
%Q[ * test functions.]
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
IO
.
read
(
init
)
mrbc
.
run
f
,
mrbs
,
'mrbtest_irep'
gems
.
each
do
|
g
|
f
.
puts
%Q[void GENERATED_TMP_mrb_
#{
g
.
funcname
}
_gem_test(mrb_state *mrb);]
end
f
.
puts
%Q[void mrbgemtest_init(mrb_state* mrb) {]
gems
.
each
do
|
g
|
f
.
puts
%Q[ GENERATED_TMP_mrb_
#{
g
.
funcname
}
_gem_test(mrb);]
end
f
.
puts
%Q[}]
end
end
end
test/t/syntax.rb
View file @
c6aa87c8
assert
(
'__FILE__'
)
do
file
=
__FILE__
assert_true
't
est/t/syntax.rb'
==
file
||
'test\
t\syntax.rb'
==
file
file
=
__FILE__
.
split
(
'test/'
)[
1
]
assert_true
't
/syntax.rb'
==
file
||
'
t\syntax.rb'
==
file
end
assert
(
'__LINE__'
)
do
...
...
travis_config.rb
View file @
c6aa87c8
...
...
@@ -38,3 +38,13 @@ MRuby::Build.new('cxx_abi') do |conf|
build_mrbc_exec
end
MRuby
::
Build
.
new
(
'test'
)
do
|
conf
|
toolchain
:gcc
enable_debug
conf
.
enable_bintest
conf
.
gembox
'full-core'
conf
.
gem
:core
=>
"mruby-test"
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