summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-04-08 03:25:28 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-04-08 03:25:28 -0700
commit5dea19e9be5d05553df18a5e022911da83fcccbc (patch)
treeb406320f4321cb4735a1c79eb6c1fb6434aa0e62 /tasks
parent0d8aa67a37a54630ca5f0d4c5d26fb952ddcf267 (diff)
parent6e28c0eb28811a06ca90b38d6b448d785f52b50a (diff)
downloadmruby-5dea19e9be5d05553df18a5e022911da83fcccbc.tar.gz
mruby-5dea19e9be5d05553df18a5e022911da83fcccbc.zip
Merge pull request #1150 from monaka/pr-add-test-runner-support
Add "test runner" support for cross builds.
Diffstat (limited to 'tasks')
-rw-r--r--tasks/mruby_build.rake15
-rw-r--r--tasks/mruby_build_commands.rake20
2 files changed, 33 insertions, 2 deletions
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index e24a8ac61..dcb557bfd 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -194,10 +194,21 @@ module MRuby
end # Build
class CrossBuild < Build
+ attr_block %w(test_runner)
+
+ def initialize(name, &block)
+ @test_runner = Command::CrossTestRunner.new(self)
+ super
+ end
+
def run_test
mrbtest = exefile("#{build_dir}/test/mrbtest")
- puts "You should run #{mrbtest} on target device."
- puts
+ if (@test_runner.command == nil)
+ puts "You should run #{mrbtest} on target device."
+ puts
+ else
+ @test_runner.run(mrbtest)
+ end
end
end # CrossBuild
end # MRuby
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index b647ccf98..b968d07be 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -259,4 +259,24 @@ module MRuby
end
end
end
+
+ class Command::CrossTestRunner < Command
+ attr_accessor :runner_options
+ attr_accessor :verbose_flag
+ attr_accessor :flags
+
+ def initialize(build)
+ super
+ @command = nil
+ @runner_options = '%{flags} %{infile}'
+ @verbose_flag = ''
+ @flags = []
+ end
+
+ def run(testbinfile)
+ puts "TEST for " + @build.name
+ _run runner_options, { :flags => [flags, verbose_flag].flatten.join(' '), :infile => testbinfile }
+ end
+ end
+
end