Write an IR visitor

This commit is contained in:
2022-06-12 23:48:50 +02:00
parent 3f1492947c
commit 72a60be386
6 changed files with 465 additions and 222 deletions

View File

@ -49,20 +49,26 @@ task test: BINARY do
.new(test)
.sub_ext('.txt')
.sub(/^build\/[[:alpha:]]+\//, 'tests/expectations/')
.read
.to_i
.to_path
puts "Running #{test}"
if test.include? '/riscv/'
system('/opt/riscv/bin/spike',
'/opt/riscv/riscv32-unknown-elf/bin/pk', test,
{ out: '/dev/null' })
spike = [
'/opt/riscv/bin/spike',
'/opt/riscv/riscv32-unknown-elf/bin/pk',
test
]
diff = ['diff', '-Nur', '--color', expected, '-']
tail = ['tail', '-n', '1']
last_stdout, wait_threads = Open3.pipeline_r spike, tail, diff
else
raise 'Unsupported test platform'
end
actual = $?.exitstatus
print last_stdout.read
last_stdout.close
fail "#{test}: Expected #{expected}, got #{actual}" unless expected == actual
fail unless wait_threads.last.value.exitstatus.zero?
end
end