diff --git a/lib/auxiliary/time_helper.rb b/lib/auxiliary/time_helper.rb index 1bcbaa20..9c1aaf5a 100644 --- a/lib/auxiliary/time_helper.rb +++ b/lib/auxiliary/time_helper.rb @@ -24,5 +24,9 @@ def seconds_to_time(sec) def time_diff(start, finish) ((finish - start) * 24 * 60 * 60).to_i end + + def current_timestamp + Time.now.strftime('%Y_%m_%d_%H_%M_%S') + end end end diff --git a/lib/engines/hcktest/tests.rb b/lib/engines/hcktest/tests.rb index a21f57b0..e8993061 100644 --- a/lib/engines/hcktest/tests.rb +++ b/lib/engines/hcktest/tests.rb @@ -289,7 +289,7 @@ def all_tests_finished? status_count('InQueue').zero? && current_test.nil? end - def collect_memory_dump(machine, l_tmp_path) + def download_memory_dump(machine, l_tmp_path) exist = @tools.exists_on_machine?(machine, '${env:SystemRoot}/Minidump') @logger.debug("Checking Minidump exist on #{machine}: #{exist}") return false unless exist @@ -301,16 +301,23 @@ def collect_memory_dump(machine, l_tmp_path) true end + def download_memory_dumps(l_tmp_path) + downloaded_client = download_memory_dump(@client.name, "#{l_tmp_path}/#{@client.name}_#{current_timestamp}") + unless @support.nil? + downloaded_support = download_memory_dump(@support.name, + "#{l_tmp_path}/#{@support.name}_#{current_timestamp}") + end + + downloaded_client || downloaded_support + end + def collect_memory_dumps(test) id = test['id'] l_zip_path = "#{@project.workspace_path}/memory_dump_#{id}.zip" l_tmp_path = "#{@project.workspace_path}/tmp_#{id}" - collected_client = collect_memory_dump(@client.name, "#{l_tmp_path}/#{@client.name}") - collected_support = collect_memory_dump(@support.name, "#{l_tmp_path}/#{@support.name}") unless @support.nil? - - if collected_client || collected_support + if download_memory_dumps(l_tmp_path) create_zip_from_directory(l_zip_path, l_tmp_path) @tests_extra[id]['dump'] = l_zip_path end diff --git a/lib/project.rb b/lib/project.rb index ebd0a640..11974787 100644 --- a/lib/project.rb +++ b/lib/project.rb @@ -11,6 +11,7 @@ require './lib/auxiliary/json_helper' require './lib/auxiliary/id_gen' require './lib/auxiliary/extra_software/manager' +require './lib/auxiliary/time_helper' # AutoHCK module module AutoHCK @@ -113,7 +114,7 @@ def move_workspace_to(path) def init_class_variables @config = Json.read_json(CONFIG_JSON, @logger) - @timestamp = create_timestamp + @timestamp = current_timestamp @engine_type = @config["#{@options.mode}_engine"] @run_terminated = false end @@ -187,10 +188,6 @@ def check_run_termination @github.handle_cancel end - def create_timestamp - Time.now.strftime('%Y_%m_%d_%H_%M_%S') - end - def init_workspace @workspace_path = [@config['workspace_path'], @engine_type, @config['setupmanager']].join('/')