File: test.rake

package info (click to toggle)
mruby 3.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,584 kB
  • sloc: ansic: 51,933; ruby: 29,510; yacc: 7,077; cpp: 517; makefile: 51; sh: 42
file content (84 lines) | stat: -rw-r--r-- 2,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
desc "build and run all mruby tests"
task :test => "test:build" do
  Rake::Task["test:run"].invoke
end

namespace :test do |test_ns|
  desc "build and run library tests"
  task :lib => "build:lib" do
    test_ns["run:lib"].invoke
  end

  desc "build and run command binaries tests"
  task :bin => "rake:all" do
    test_ns["run:bin"].invoke
  end

  desc "build all mruby tests"
  task :build => "build:lib"

  namespace :build do |test_build_ns|
    desc "build library tests"
    task :lib => "rake:all" do
      MRuby.each_target{|build| build.gem(core: 'mruby-test')}
      test = test_build_ns["lib_without_loading_gem"]
      test.invoke if test
    end
  end

  desc "run all mruby tests"
  task :run

  namespace :run do
    desc "run library tests"
    task :lib

    desc "run command binaries tests"
    task :bin
  end

  desc "run all mruby tests serially"
  task "run:serial" => "build" do
    Rake::Task["test:run"].prerequisite_tasks.each(&:invoke)
  end

  desc "run library tests serially"
  task "run:serial:bin" => "build:bin" do
    Rake::Task["test:run:lib"].prerequisite_tasks.each(&:invoke)
  end

  desc "run command binaries tests serially"
  task "run:serial:lib" => "build:lib" do
    Rake::Task["test:run:bin"].prerequisite_tasks.each(&:invoke)
  end
end

MRuby.each_target do |build|
  if build.test_enabled?
    t = task "test:build:lib_without_loading_gem:#{build.name}" do
      gem = build.gems["mruby-test"]
      gem.setup
      gem.setup_compilers
      Rake::Task[build.define_installer_if_needed("mrbtest")].invoke
    end
    task "test:build:lib_without_loading_gem" => t

    t = task "test:run:lib:#{build.name}" do
      build.run_test
    end
    task "test:run" => t
    task "test:run:lib" => t
  end
  if build.bintest_enabled?
    t = task "test:run:bin:#{build.name}" do
      build.run_bintest
    end
    task "test:run" => t
    task "test:run:bin" => t
  end
end

task :clean do
  host = MRuby.targets["host"]
  rm_f host.exefile("#{host.class.install_dir}/mrbtest") if host && host.test_enabled?
end