forked from SeaRbSg/nand2tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
69 lines (58 loc) · 1.6 KB
/
Rakefile
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
task :default => :test
user = ENV["GH"]
user ||= "zenspider" if ENV["USER"] == "ryan"
user = "nanoxd" if ENV["USER"] == "nano"
user = "thagomizer" if ENV["USER"] == "aja"
user = "jf647" if ENV["USER"] = "james"
skip = {
"05" => %w[Memory.tst],
}
skip.default = []
if user then
%w(01 02 03/a 03/b 04/fill 04/mult 05).reverse.each do |n|
desc "Test chapter #{n}."
task "ch#{n}" do
Dir["#{user}/#{n}/*.tst"].each do |f|
if skip[n].include? File.basename(f) then
warn "Skipping #{f}. Please run by hand."
next
end
f = File.expand_path f
sh "./tools/HardwareSimulator.sh #{f}"
end
end
desc "Run all the tests"
task :test => "ch#{n}"
end
else
warn "Run or define GH=<your-github-username> for automated testing."
end
def run cmd
f1 = File.expand_path ENV["F"] if ENV["F"]
f2 = File.expand_path ENV["F2"] if ENV["F2"]
sh "./tools/#{cmd}.sh #{f1} #{f2}"
end
desc "Run the hardware simulator; Opt: use F=<username/.../f.tst> to run a test"
task :hdl do
run "HardwareSimulator"
end
desc "Run the assembler; Opt: use F=<username/.../blah.asm>"
task :asm do
run "Assembler"
end
desc "Run the CPU emulator; Opt: use F=<username/.../f.tst> to run a test."
task :cpu do
run "CPUEmulator"
end
desc "Run the VM emulator; Opt: use F=<username/.../f.tst> to run a test."
task :vm do
run "VMEmulator"
end
desc "Run the Jack compiler; Opt: use F=<username/.../f.jack> to compile."
task :jack do
run "JackCompiler"
end
desc "Run the Jack compiler; Opt: use F=<username/.../f.jack> to diff."
task :diff do
run "TextComparer"
end