quokkadb 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/quokkadb/adb.rb +10 -8
- data/lib/quokkadb.rb +37 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fae6990c8b8c093f96f8b0ed0b439053aa0e8fd
|
4
|
+
data.tar.gz: dfb982eefe167628101b6c072fc85d953dec318a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 124aefe9ad62d314b8af69c2917f8b69548a12f1b905daa935f0dbafaa6beaebf38f82f095cd661dbc5f1749df112792c2aa647471e9e44291b560b161573501
|
7
|
+
data.tar.gz: b63adf55be4f723084776a22a152dca8687da540d0a5459fbdb3b2e09650b741dc899b8bfbf92963efc4ed60139d3276626a0f7eba879ece974154a1cfdb9474
|
data/lib/quokkadb/adb.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
|
1
|
+
class ADB
|
2
2
|
|
3
|
-
|
3
|
+
attr_accessor :callback
|
4
|
+
|
5
|
+
def find_tests(runner:, package:, serial: nil, annotation: nil, shards: nil, index: nil)
|
4
6
|
puts("adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} -e numShards 4 -e shardIndex 0 -r -w #{package}/#{runner}\n")
|
5
7
|
`adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} #{shards ? "-e numShards #{shards}" : ''} #{index ? "-e shardIndex #{index}" : ''} -e log true -r -w #{package}/#{runner}`
|
6
8
|
end
|
7
9
|
|
8
|
-
def
|
10
|
+
def execute_test(runner:, package:, test_name:, class_name:)
|
9
11
|
puts("adb shell am instrument -w -e class #{class_name}##{test_name} #{package}/#{runner}")
|
10
12
|
`adb shell am instrument -w -e class #{class_name}##{test_name} #{package}/#{runner}`
|
11
13
|
end
|
12
14
|
|
13
|
-
def
|
15
|
+
def mass_execute(runner:, package:, tests:)
|
14
16
|
tests_list = []
|
15
17
|
tests.each do |test_info|
|
16
18
|
tests_list.push("#{test_info.class_name}##{test_info.name}")
|
@@ -20,16 +22,16 @@ module ADB
|
|
20
22
|
`adb shell am instrument -w -e class #{tests_list.join(',')} -r #{package}/#{runner}`
|
21
23
|
end
|
22
24
|
|
23
|
-
def
|
24
|
-
command = "adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} #{
|
25
|
+
def run_tests(runner:, package:, serial: nil, annotation: nil, shards: nil, index: nil)
|
26
|
+
command = "adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} #{generate_sharding_options(shards: shards, index: index)} -r -w #{package}/#{runner}"
|
25
27
|
puts("Command: #{command}")
|
26
28
|
pipe = IO.popen(command)
|
27
29
|
while (line = pipe.gets)
|
28
|
-
callback.call(line)
|
30
|
+
@callback.call(line)
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
|
-
def
|
34
|
+
def generate_sharding_options(shards:, index:)
|
33
35
|
return "" unless shards
|
34
36
|
|
35
37
|
"#{shards != '' ? "-e numShards #{shards}" : ''} #{index && index != '' ? "-e shardIndex #{index}" : ''}"
|
data/lib/quokkadb.rb
CHANGED
@@ -1,26 +1,46 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require_relative './quokkadb/adb.rb'
|
2
|
+
require_relative './quokkadb/test.rb'
|
3
|
+
require_relative './quokkadb/test_result.rb'
|
4
|
+
require_relative './quokkadb/adb_test_parser.rb'
|
5
5
|
require 'colorize'
|
6
6
|
|
7
|
-
|
7
|
+
class QuokkADB
|
8
8
|
|
9
|
-
|
9
|
+
attr_accessor :ADB
|
10
|
+
attr_accessor :parser
|
11
|
+
|
12
|
+
def initialize(runner:, package:, annotation: nil, shards: nil, index: nil, serial: nil, background_black: false)
|
13
|
+
@runner = runner
|
14
|
+
@package = package
|
15
|
+
@annotation = annotation
|
16
|
+
@shards = shards
|
17
|
+
@index = index
|
18
|
+
@serial = serial
|
19
|
+
@background_black = background_black
|
20
|
+
|
21
|
+
@ADB = ADB.new()
|
22
|
+
@parser = ADBTestParser.new()
|
23
|
+
end
|
24
|
+
|
25
|
+
def run()
|
10
26
|
full_log = ""
|
11
|
-
|
12
|
-
ADB.run_tests(
|
13
|
-
runner: runner,
|
14
|
-
package: package,
|
15
|
-
annotation: annotation,
|
16
|
-
shards: shards,
|
17
|
-
index: index,
|
18
|
-
serial: serial
|
19
|
-
) { |line|
|
27
|
+
@ADB.callback = lambda { |line|
|
20
28
|
full_log += line
|
21
|
-
parser.parse_line(line: line, background_black: background_black)
|
29
|
+
@parser.parse_line(line: line, background_black: @background_black)
|
22
30
|
}
|
31
|
+
@ADB.run_tests(
|
32
|
+
runner: @runner,
|
33
|
+
package: @package,
|
34
|
+
annotation: @annotation,
|
35
|
+
shards: @shards,
|
36
|
+
index: @index,
|
37
|
+
serial: @serial
|
38
|
+
)
|
39
|
+
|
40
|
+
parse_results(full_log)
|
41
|
+
end
|
23
42
|
|
43
|
+
def parse_results(full_log)
|
24
44
|
full_log.each_line do |log|
|
25
45
|
if (log.include?("FAILURES!!!") or log.include?("Process crashed while executing") or log.include?("INSTRUMENTATION_FAILED"))
|
26
46
|
puts("exit 1")
|
@@ -28,7 +48,7 @@ module QuokkADB
|
|
28
48
|
end
|
29
49
|
end
|
30
50
|
|
31
|
-
parser.test_results.each do |result|
|
51
|
+
@parser.test_results.each do |result|
|
32
52
|
if (!result.passed)
|
33
53
|
puts("exit 1")
|
34
54
|
exit(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quokkadb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Beveridge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ADB test parsing libraryr
|
14
14
|
email: joe.beveridge@shopify.com
|