test/test_helper.rb in ruboto-0.10.1 vs test/test_helper.rb in ruboto-0.10.2.rc.0
- old
+ new
@@ -18,11 +18,11 @@
ENV['GEM_PATH'] = GEM_PATH
ENV['PATH'] = "#{GEM_PATH}/bin:#{ENV['PATH']}"
Gem.paths = GEM_PATH
Gem.refresh
`gem query -i -n bundler`
- system 'gem install bundler --no-ri --no-rdoc' unless $? == 0
+ system 'gem install bundler -v "!=1.3.1" --no-ri --no-rdoc' unless $? == 0
`bundle check`
system 'bundle --system' unless $? == 0
lib_path = File.expand_path('lib', File.dirname(File.dirname(__FILE__)))
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
require 'ruboto'
@@ -37,17 +37,17 @@
'2.1' => 'android-7', '2.1-update1' => 'android-7', '2.2' => 'android-8',
'2.3' => 'android-9', '2.3.1' => 'android-9', '2.3.2' => 'android-9',
'2.3.3' => 'android-10', '2.3.4' => 'android-10',
'3.0' => 'android-11', '3.1' => 'android-12', '3.2' => 'android-13',
'4.0.1' => 'android-14', '4.0.3' => 'android-15', '4.0.4' => 'android-15',
- '4.1' => 'android-16', '4.1.1' => 'android-16',
+ '4.1' => 'android-16', '4.1.1' => 'android-16', '4.1.2' => 'android-16',
'4.2' => 'android-17',
}
def self.version_from_device
- puts "Reading OS version from device/emulator"
- system "adb wait-for-device"
+ puts 'Reading OS version from device/emulator'
+ system 'adb wait-for-device'
IO.popen('adb bugreport').each_line do |line|
if line =~ /sdk-eng (.*?) .*? .*? test-keys/
version = $1
api_level = VERSION_TO_API_LEVEL[version]
raise "Unknown version: #{version}" if api_level.nil?
@@ -55,11 +55,11 @@
end
if line =~ /\[ro\.build\.version\.sdk\]: \[(\d+)\]/
return $1
end
end
- raise "Unable to read device/emulator apilevel"
+ raise 'Unable to read device/emulator apilevel'
end
def self.install_jruby_jars_gem
jars_version_from_env = ENV['JRUBY_JARS_VERSION'] unless RUBOTO_PLATFORM == 'CURRENT'
version_requirement = " -v #{jars_version_from_env}" if jars_version_from_env
@@ -115,14 +115,14 @@
puts "ANDROID_SDK_TOOLS_REVISION: #{ANDROID_TOOLS_REVISION}"
RUBOTO_PLATFORM = ENV['RUBOTO_PLATFORM'] || 'CURRENT'
puts "RUBOTO_PLATFORM: #{RUBOTO_PLATFORM}"
- install_jruby_jars_gem
+ install_jruby_jars_gem unless RUBOTO_PLATFORM == 'CURRENT'
if RUBOTO_PLATFORM == 'CURRENT'
- JRUBY_JARS_VERSION = Gem::Version.new('1.7.1.dev')
+ JRUBY_JARS_VERSION = Gem::Version.new('1.7.1')
else
# FIXME(uwe): Simplify when we stop supporting rubygems < 1.8.0
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
gem_spec = Gem::Specification.find_by_path 'jruby-jars'
else
@@ -261,45 +261,22 @@
puts "Skipping instrumentation tests on #{ANDROID_OS} since they don't work."
return
end
check_platform_installation
Dir.chdir APP_DIR do
- # FIXME(uwe): Simplify when we stop supporting JRuby < 1.7.0 which causes the ArrayIndexOutOfBoundsException
- # FIXME(uwe): Simplify if we find a cause for the system crashes.
- # system 'rake test:quick' # This line should replace all those below.
-
- retries = 0
- loop do
- output = `rake test:quick`
- puts output
- break if $? == 0
- retries += 1
- # FIXME(uwe): The cause of the system crash is unnown. We should investigate.
- if output =~ /INSTRUMENTATION_ABORTED: System has crashed./
- puts "System crash detected."
- elsif (RUBOTO_PLATFORM == 'CURRENT' || JRUBY_JARS_VERSION < Gem::Version.new('1.7.0')) &&
- output =~ /INSTRUMENTATION_RESULT: longMsg=java.lang.ArrayIndexOutOfBoundsException/
- puts "Known ArrayIndexOutOfBoundsException failure detected. Retrying (#{retries})."
- else
- break
- end
- break if retries >= 3
- puts "Retrying (#{retries})."
- end
- # EMXIF
-
+ system 'rake test:quick'
assert_equal 0, $?, "tests failed with return code #$?"
end
end
def check_platform_installation
if RUBOTO_PLATFORM == 'STANDALONE'
system 'rake platform:uninstall'
elsif RUBOTO_PLATFORM == 'CURRENT'
- system "rake platform:current platform:install"
+ system 'rake platform:current'
elsif RUBOTO_PLATFORM == 'FROM_GEM'
- system "rake platform:debug platform:install"
+ system 'rake platform:install'
else
fail "Unknown Ruboto platform: #{RUBOTO_PLATFORM.inspect}"
end
if $? != 0
FileUtils.rm_rf 'tmp/RubotoCore'
@@ -311,10 +288,14 @@
puts "Adding ruboto.yml: #{excluded_stdlibs.join(' ')}"
File.open('ruboto.yml', 'w') { |f| f << YAML.dump({:excluded_stdlibs => excluded_stdlibs}) }
end
def write_gemfile(bundle)
- puts "Adding Gemfile.apk: #{[*bundle].join(' ')}"
- File.open('Gemfile.apk', 'w') { |f| f << "source :rubygems\n\ngem 'sqldroid'\n" }
+ gems = [*bundle]
+ puts "Adding Gemfile.apk: #{gems.join(' ')}"
+ File.open('Gemfile.apk', 'w') do |f|
+ f << "source :rubygems\n\n"
+ gems.each{|g| f << "gem '#{g}'\n"}
+ end
end
end