From 620cf59b4d9a4513de24971cd17ea97f84906939 Mon Sep 17 00:00:00 2001 From: Corey Werner Date: Tue, 20 Apr 2021 06:10:18 +0300 Subject: [PATCH] [scan] Keep initial xcresult (#18555) * retry test shouldnt remove initial xcresult * fix tests --- scan/lib/scan/runner.rb | 2 ++ scan/lib/scan/test_command_generator.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scan/lib/scan/runner.rb b/scan/lib/scan/runner.rb index e5ce644754b..54f99bb4eef 100644 --- a/scan/lib/scan/runner.rb +++ b/scan/lib/scan/runner.rb @@ -55,6 +55,8 @@ def test_app end def execute(retries: 0) + Scan.cache[:retry_attempt] = Scan.config[:number_of_retries] - retries + command = @test_command_generator.generate prefix_hash = [ diff --git a/scan/lib/scan/test_command_generator.rb b/scan/lib/scan/test_command_generator.rb index 9be93e7b510..050179bfa8f 100644 --- a/scan/lib/scan/test_command_generator.rb +++ b/scan/lib/scan/test_command_generator.rb @@ -164,8 +164,10 @@ def build_path # The path to the result bundle def result_bundle_path + retry_count = Scan.cache[:retry_attempt] || 0 + attempt = retry_count > 0 ? "-#{retry_count}" : "" ext = FastlaneCore::Helper.xcode_version.to_i >= 11 ? '.xcresult' : '.test_result' - path = File.join(Scan.config[:output_directory], Scan.config[:scheme]) + ext + path = File.join(Scan.config[:output_directory], Scan.config[:scheme]) + attempt + ext if File.directory?(path) FileUtils.remove_dir(path) end