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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e7dcc40d67413a5b35f7eba1289d75724965a63
4
- data.tar.gz: 7ea917dd613f5fcdd8e6a41471538c01bf9df4d2
3
+ metadata.gz: 61ae96758615ce1185744290070e987ded9759c5
4
+ data.tar.gz: 925f308dac333b4275ac2768d2a142aac3746912
5
5
  SHA512:
6
- metadata.gz: b786211a86a81b9483a8721de939de4bcb7eba683698e334d6f299e706153ee607a3b8de6621599465cecbf236b42805618f2e71812a664c9c9cf8abd20c8ae3
7
- data.tar.gz: 1295e3a8a1e7040d0acadf14d42e2c36838f9fdde95c8d57c83b4bcaa4986165b689239a27cdecbdb512233110b3d54c40d1175c649f7c8b7c267642495c47bf
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 imabalances (both internal to the partition sets, and amongst them).
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
 
@@ -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
@@ -7,5 +7,5 @@ require 'xcknife/exceptions'
7
7
  require 'xcknife/xcscheme_analyzer'
8
8
 
9
9
  module XCKnife
10
- VERSION = '0.6.4'
10
+ VERSION = '0.6.5'
11
11
  end
@@ -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 a 2-aproximation to the optimal partition_time, which is an instance of the Open shop scheduling problem (which is NP-hard)
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 'pp'
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
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-02-22 00:00:00.000000000 Z
11
+ date: 2017-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler