Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useful info to log #366

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/engines/hcktest/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,20 @@ def summary_results_log
@tests.reduce('') do |sum, test|
Jedoku marked this conversation as resolved.
Show resolved Hide resolved
extra_info = @tests_extra.dig(test['id'], 'dump') ? '(with Minidump)' : ''
status = @tests_extra.dig(test['id'], 'status') || test['status']
sum + "#{status}: #{test['name']} [#{test['estimatedruntime']}] #{extra_info}\n"

sum + "#{status}: #{test['name']} [#{test['estimatedruntime']}]#{extra_info}#{format_times(test)}\n"
end
end

def format_times(test)
queued_at = @tests_extra.dig(test['id'], 'queued_at')
queued_at_str = queued_at ? " [Queued time: #{queued_at}]" : ''
started_at = @tests_extra.dig(test['id'], 'started_at')
started_at_str = started_at ? " [Started time: #{started_at}]" : ''

"#{queued_at_str}#{started_at_str}"
end

def update_summary_results_log
logs = summary_rejected_test_log
logs += summary_results_log
Expand Down
6 changes: 3 additions & 3 deletions lib/setupmanagers/qemuhck/qemu_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def initialize(scope, logger, machine, run_name, run_opts)
@run_opts = run_opts
@keep_alive = run_opts[:keep_alive]
@delete_snapshot = run_opts[:create_snapshot]
@machine.dump_config
@logger.info(@machine.dump_config)
@qemu_thread = Thread.new { run_vm }
scope << self
end
Expand Down Expand Up @@ -581,7 +581,7 @@ def dump_config
# S3 enabled..................${ENABLE_S3}
# S4 enabled..................${ENABLE_S4}
# Snapshot mode.............. ${SNAPSHOT}
@logger.info(full_replacement_map.replace(config.join("\n")))
full_replacement_map.replace(config.join("\n"))
end

def create_run_script(file_name, file_content)
Expand Down Expand Up @@ -660,7 +660,7 @@ def merge_commands_array(arr)
end

def dump_commands
dump_config
@logger.info(dump_config)

file_name = "#{@workspace_path}/#{@run_name}_manual.sh"
content = <<~BASH
Expand Down
36 changes: 36 additions & 0 deletions lib/setupmanagers/qemuhck/qemuhck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class QemuHCK

attr_reader :kit, :project

QEMUHCK_INFO_LOG_FILE = 'qemuhck.txt'
OPT_NAMES = %w[viommu_state s3_state s4_state enlightenments_state vhost_state machine_type fw_type cpu
pluggable_memory_gb].freeze

Expand All @@ -24,6 +25,7 @@ def initialize(project)
@clients_vm = {}
initialize_studio_vm
initialize_clients_vm
create_qemuhck_log_file
end

def initialize_project(project)
Expand Down Expand Up @@ -108,6 +110,40 @@ def initialize_clients_vm
end
end

def create_qemuhck_log_file
qemuhck_log = "#{@workspace_path}/#{QEMUHCK_INFO_LOG_FILE}"
File.write(qemuhck_log, collect_environment_info)
@project.result_uploader.upload_file(qemuhck_log, QEMUHCK_INFO_LOG_FILE)
end

def collect_environment_info
logs = String.new
append_host_info(logs)
append_vms_info(logs)
logs.freeze
end

def append_host_info(logs)
logs << <<~HOST_INFO
QEMU version: #{`qemu-system-x86_64 --version`.lines.first.strip}
System information: #{`uname -a`.strip}

HOST_INFO
end

def append_vms_info(logs)
logs << <<~STUDIO_INFO
Studio Properties:
#{@studio_vm.dump_config}
STUDIO_INFO
@platform['clients'].each_with_index do |(_k, v), i|
logs << <<~CLIENT_INFO
Client #{i + 1} Properties:
#{@clients_vm[v['name']].dump_config}
CLIENT_INFO
end
end

def check_studio_image_exist
@studio_vm.check_image_exist
end
Expand Down
Loading