#!/usr/local/bin/ruby # = Master Test Suite for Navel Technology Revision 2 (n2) # # === FIXME: # # - move this to tools/ or something. # - remove this unshift crap (have to fix some tests) # # * gmosx, ekarak # # (c) 2003 Navel, all rights reserved. # $Id: run.rb 79 2004-10-18 16:38:19Z gmosx $ ($:).unshift ".." require "test/unit" # FIXME: remove n1 dependencies! require "n1/og" require "n1/utils/arrays" require "n1/utils/time-utils" require "n1/utils/string-utils" require "n/std" require "n/logger" #--------------------------------------------------------------- # parse parameters, setup. # enable n2 logging. LOG = ARGV.include?("--log") # enable this to run all the tests, even time consuming ones. FULL_TEST = ("--full" == ARGV.pop) # FIXME: have a flag to set the logger to show debug info! if LOG $log = Logger.new(STDERR) else $log = Logger.new("test-all.out") end #--------------------------------------------------------------- # locate all testcases # add time consuming tests here! time_consuming_testcases = [ "mixins/tc-expirable.rb", "odb/backends/tc-mysql.rb" ] # add tests to exclude here! excluded_testcases = [ "web/server/tc-modruby-adapter.rb", # tml, FIXME: re-enable these CRITICAL tests! "web/server/handlers/tc-page-handler.rb", "web/server/handlers/tc-rx-handler.rb", "web/server/handlers/tc-action-handler.rb" ] testcases = %x{ find . -name "tc-*.rb" -print0 } testcases = testcases.split("\0").collect { |tc| tc[2..tc.length] } testcases = testcases - excluded_testcases testcases = (testcases - time_consuming_testcases) unless FULL_TEST # shuffle is used to test for missing requires. testcases.shuffle.each { |tc| require tc } #--------------------------------------------------------------- # perform tests if FULL_TEST puts "syntax checking ruby (.rb) files" str = %x{ find . -name "*.rb" | xargs -n1 ruby -c} $log.warn(str) unless $? == 0 count = %x{find . -name "*.rb" | wc -l} puts "#{count.chop} files validated!" puts "syntax checking xml (.sx, .si, etc) files" str = %x{ find . -name "*.s[x|i]" | xargs -n1 xmllint --noout } $log.warn(str) unless $? == 0 count = %x{find . -name "*.s[x|i]" | wc -l} puts "#{count.chop} files validated!" end # TestUnit uses reflection to perfom the tests now. # ...