Skip to content

Commit

Permalink
Add TIMESTAMP to collected dump folder
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Chulak <[email protected]>
  • Loading branch information
Jedoku committed Feb 22, 2024
1 parent 69f3431 commit 38b96a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions lib/auxiliary/time_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 12 additions & 5 deletions lib/engines/hcktest/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")

Check notice

Code scanning / Rubocop

Align the arguments of a method call if they span more than one line. Note test

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.
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
Expand Down
7 changes: 2 additions & 5 deletions lib/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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('/')
Expand Down

0 comments on commit 38b96a7

Please sign in to comment.