compiler/test/test.rb
Sami Samhuri a4506bab10 [NEW] First hints of cross-platform support. Compiles to Mach-O on Darwin with nasm and gcc.
There is no binary assembler support for Darwin yet! I'm not sure when I will dive into the details
of generating a Mach-O binary from Ruby or C.

[MERGED] Binary assembler support.  It *should* work on ELF but it needs testing on Linux.
2009-05-25 16:26:21 -07:00

25 lines
684 B
Ruby
Executable file

#!/usr/bin/env ruby
ROOT = Dir.pwd.sub(/\/test.*$/, '')
$LOAD_PATH << ROOT
require 'build'
# usage: build.rb <func> [binformat]
#
# ([format] will go before [binformat])
def main
func = ARGV[0].to_s
format = 'asm' # 'bin' only assembles one or two
# instructions right now, but support
# is in place
binformat = (ARGV[1] ? ARGV[1] : 'elf').downcase
platform = `uname -s`.chomp.downcase
print "testing #{func} ... "
success = run( build("test_#{func}.code", platform, format, binformat) )
puts success == 0 ? "pass" : "FAIL! (#{success})"
exit(success.to_i)
end
main if $0 == __FILE__