Grow stack automatically

This commit is contained in:
2024-02-18 11:26:57 +01:00
parent df2494e145
commit 86d579e8d5
12 changed files with 262 additions and 146 deletions

View File

@ -39,40 +39,9 @@ file BINARY => SOURCES do |t|
sh({ 'DFLAGS' => (DFLAGS * ' ') }, 'dub', 'build', '--compiler=gdc')
end
task default: TESTS
task default: BINARY
desc 'Run all tests and check the results'
task test: TESTS
task test: BINARY do
TESTS.each do |test|
expected = Pathname
.new(test)
.sub_ext('.txt')
.sub(/^build\/[[:alpha:]]+\//, 'tests/expectations/')
.to_path
puts "Running #{test}"
if test.include? '/riscv/'
spike = [
'/opt/riscv/bin/spike',
'--isa=RV32IMAC',
'/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
print last_stdout.read
last_stdout.close
fail unless wait_threads.last.value.exitstatus.zero?
end
end
desc 'Run unittest blocks'
task unittest: SOURCES do |t|
sh('dub', 'test', '--compiler=gdc-12')