xcknife 0.6.4 → 0.6.5
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/README.md +3 -2
- data/example/run_example.rb +1 -0
- data/lib/xcknife.rb +1 -1
- data/lib/xcknife/stream_parser.rb +5 -4
- data/lib/xcknife/xctool_cmd_helper.rb +14 -1
- 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: 61ae96758615ce1185744290070e987ded9759c5
|
4
|
+
data.tar.gz: 925f308dac333b4275ac2768d2a142aac3746912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7258f576308b34b5c69b16219941b889ea78e9e2ec0c072a52f3374e171ae157562e854a44ed650236716b293f536637900dfe569bf10df45b1105b5315dd09
|
7
|
+
data.tar.gz: e014902ceec3b6aa54f75668839c7dc51efa920940206b4321e975bda55a82f504b94d57a83dc6b590e69b6e1fb10d3a71f46d3af22cd86d6e47c3521de79277
|
data/README.md
CHANGED
@@ -20,9 +20,10 @@ More information on XCKnife, go [here](https://corner.squareup.com/2016/06/xckni
|
|
20
20
|
```
|
21
21
|
$ xcknife --help
|
22
22
|
Usage: xcknife [options] worker-count historical-timings-json-stream-file [current-tests-json-stream-file]
|
23
|
-
-p, --partition TARGETS Comma separated list of targets. Can be used multiple times
|
23
|
+
-p, --partition TARGETS Comma separated list of targets. Can be used multiple times.
|
24
24
|
-o, --output FILENAME Output file. Defaults to STDOUT
|
25
25
|
-a, --abbrev Results are abbreviated
|
26
|
+
-x, --xcodebuild-output Output is formatted for xcodebuild
|
26
27
|
-h, --help Show this message
|
27
28
|
```
|
28
29
|
|
@@ -68,7 +69,7 @@ This will balance the tests onthe `iPhoneTestTarget` into 3 machines. The output
|
|
68
69
|
}]}]}
|
69
70
|
```
|
70
71
|
|
71
|
-
This provides a lot of data about the partitions and their
|
72
|
+
This provides a lot of data about the partitions and their imbalances (both internal to the partition sets, and amongst them).
|
72
73
|
|
73
74
|
If you only want the *-only* arguments, run with the `-a` flag:
|
74
75
|
|
data/example/run_example.rb
CHANGED
@@ -26,6 +26,7 @@ def run(historical_file, current_file)
|
|
26
26
|
partition_set.each do |partition|
|
27
27
|
puts "target name for worker #{shard_number} = #{target_name}"
|
28
28
|
puts "only is: #{xctool_only_arguments(partition).inspect}"
|
29
|
+
puts "skip-only is: #{xcodebuild_skip_arguments(partition, result.test_time_for_partitions).inspect}"
|
29
30
|
shard_number += 1
|
30
31
|
end
|
31
32
|
end
|
data/lib/xcknife.rb
CHANGED
@@ -24,17 +24,18 @@ module XCKnife
|
|
24
24
|
|
25
25
|
class PartitionResult
|
26
26
|
TimeImbalances = Struct.new :partition_set, :partitions
|
27
|
-
attr_reader :stats, :test_maps, :test_times, :total_test_time, :test_time_imbalances
|
27
|
+
attr_reader :stats, :test_maps, :test_times, :total_test_time, :test_time_imbalances, :test_time_for_partitions
|
28
28
|
extend Forwardable
|
29
29
|
delegate ResultStats.members => :@stats
|
30
30
|
|
31
|
-
def initialize(stats, partition_sets)
|
31
|
+
def initialize(stats, partition_sets, test_time_for_partitions)
|
32
32
|
@stats = stats
|
33
33
|
@partition_sets = partition_sets
|
34
34
|
@test_maps = partition_sets_map(&:test_time_map)
|
35
35
|
@test_times = partition_sets_map(&:total_time)
|
36
36
|
@total_test_time = test_times.flatten.inject(:+)
|
37
37
|
@test_time_imbalances = compute_test_time_imbalances
|
38
|
+
@test_time_for_partitions = test_time_for_partitions.inject(&:merge)
|
38
39
|
end
|
39
40
|
|
40
41
|
private
|
@@ -75,7 +76,7 @@ module XCKnife
|
|
75
76
|
def compute_shards_for_partitions(test_time_for_partitions)
|
76
77
|
PartitionResult.new(@stats, split_machines_proportionally(test_time_for_partitions).map do |partition|
|
77
78
|
compute_single_shards(partition.number_of_shards, partition.test_time_map)
|
78
|
-
end)
|
79
|
+
end, test_time_for_partitions)
|
79
80
|
end
|
80
81
|
|
81
82
|
def test_time_for_partitions(historical_events, current_events = nil)
|
@@ -125,7 +126,7 @@ module XCKnife
|
|
125
126
|
partition_with_machines_list
|
126
127
|
end
|
127
128
|
|
128
|
-
# Computes
|
129
|
+
# Computes a 2-aproximation to the optimal partition_time, which is an instance of the Open shop scheduling problem (which is NP-hard)
|
129
130
|
# see: https://en.wikipedia.org/wiki/Open-shop_scheduling
|
130
131
|
def compute_single_shards(number_of_shards, test_time_map)
|
131
132
|
raise XCKnife::XCKnifeError, "There are not enough workers provided" if number_of_shards <= 0
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'set'
|
2
|
+
|
2
3
|
module XCKnife
|
3
4
|
module XCToolCmdHelper
|
4
5
|
def only_arguments_for_a_partition_set(output_type, partition_set)
|
@@ -29,8 +30,20 @@ module XCKnife
|
|
29
30
|
classes.sort.map do |clazz|
|
30
31
|
"-only-testing:#{test_target}/#{clazz}"
|
31
32
|
end
|
33
|
+
end
|
34
|
+
end
|
32
35
|
|
36
|
+
# skip-testing is available since Xcode 8
|
37
|
+
def xcodebuild_skip_arguments(single_partition, test_time_for_partitions)
|
38
|
+
excluded_targets = test_time_for_partitions.keys.to_set - single_partition.keys.to_set
|
39
|
+
skipped_target_arguments = excluded_targets.sort.map { |test_target| "-skip-testing:#{test_target}" }
|
40
|
+
|
41
|
+
skipped_classes_arguments = single_partition.flat_map do |test_target, classes|
|
42
|
+
all_classes = test_time_for_partitions[test_target].keys.to_set
|
43
|
+
(all_classes - classes.to_set).sort.map { |test_class| "-skip-testing:#{test_target}/#{test_class}" }
|
33
44
|
end
|
45
|
+
|
46
|
+
skipped_target_arguments + skipped_classes_arguments
|
34
47
|
end
|
35
48
|
|
36
49
|
def xcodebuild_only_arguments_for_a_partition_set(partition_set)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|