regression_tester.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env ruby
  2. require 'fileutils'
  3. print("Regression tester 0.0.1\n")
  4. def path_local(from)
  5. return from #from.gsub('/','//')
  6. from.gsub('/','\\\\')
  7. end
  8. TESTS_DIR="./tests"
  9. def perform_test(exepath,filepath,outname,args)
  10. output_path=path_local(TESTS_DIR+"/outputs/"+outname)
  11. exepath=path_local(exepath)
  12. output_path=path_local(output_path)
  13. filepath=path_local(filepath)
  14. joined_args = args.join(' ')
  15. printf("calling:" + "#{exepath} -a1 #{joined_args} -o#{output_path}.a1 #{filepath}\n")
  16. STDERR << "Errors for : #{filepath}\n"
  17. result = `#{exepath} -a 1 -o#{output_path}.a1 #{filepath}`
  18. result = `#{exepath} -a 2 #{joined_args} -o#{output_path}.a2 #{filepath}`
  19. result = `#{exepath} #{joined_args} -o#{output_path} #{filepath}`
  20. puts result
  21. p $?
  22. end
  23. `rm -rf #{TESTS_DIR}/outputs/*.*`
  24. #exit(1)
  25. Dir.open(TESTS_DIR+"/inputs").each() {|f|
  26. next if f=="." or f==".."
  27. perform_test(".//"+ARGV[0],TESTS_DIR+"/inputs/"+f,f,ARGV[1..-1])
  28. }
  29. Dir.open(TESTS_DIR+"/inputs").each() {|f|
  30. next if f=="." or f==".."
  31. FileUtils.mv(TESTS_DIR+"/inputs/"+f,TESTS_DIR+"/outputs/"+f) if f.end_with?(".b")
  32. }
  33. puts "**************************************\n"