Skip to content

Commit

Permalink
Added secure boot compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Chulak <[email protected]>
  • Loading branch information
Jedoku committed Feb 27, 2024
1 parent 3227db4 commit 7cca5f3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
9 changes: 8 additions & 1 deletion lib/engines/hcktest/hcktest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"playlists_path": "./playlists",
"filters_path": "./filters/UpdateFilters.sql"
"filters_path": "./filters/UpdateFilters.sql",
"tests_config": {
"requires_enabled_secure_boot": [
"Secure Boot Test - Customized Deployment Basic Test",
"Secure Boot Manual Logo Test",
"Secure Boot Logo Test"
]
}
}
2 changes: 1 addition & 1 deletion lib/engines/hcktest/hcktest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def auto_run
ResourceScope.open do |scope|
run_and_configure_setup scope
client = @client1
client.run_tests
client.run_tests(@config['tests_config'])
client.create_package
end
end
Expand Down
19 changes: 18 additions & 1 deletion lib/engines/hcktest/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,23 @@ def load_clients_system_info
build_system_info(support_sysinfo)
end

def run
def secure_boot_handler(test_name)
secure_boot_required = require_enable_secure_boot(test_name)

return unless secure_boot_required != @client.run_opts[:secure]

@client.setup_manager.stop_client(@client.name)

new_run_opts = @client.run_opts.merge!(secure: secure_boot_required)
@client.setup_manager.run_client(@client.global_scope, @client.name, new_run_opts)
end

def require_enable_secure_boot(test_name)
@config['requires_enabled_secure_boot'].include?(test_name)
end

def run(config)
@config = config
@total = @tests.count

load_clients_system_info
Expand All @@ -420,6 +436,7 @@ def run
tests = @tests
tests.each do |test|
@logger.info("Adding to queue: #{test['name']} (#{test['id']}) [#{test['estimatedruntime']}]")
secure_boot_handler(test['name'])
queue_test(test, wait: true)
list_tests
handle_test_running
Expand Down
9 changes: 6 additions & 3 deletions lib/setupmanagers/hckclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ class HCKClient
# Client cooldown sleep after thread is joined in seconds
CLIENT_COOLDOWN_SLEEP = 60

attr_reader :name, :kit
attr_reader :name, :kit, :global_scope, :setup_manager, :run_opts
attr_writer :support

def initialize(setup_manager, scope, studio, name, run_opts)
@setup_manager = setup_manager
@project = setup_manager.project
@logger = @project.logger
@studio = studio
Expand All @@ -27,6 +28,8 @@ def initialize(setup_manager, scope, studio, name, run_opts)
@logger.info("Starting client #{name}")
@runner = setup_manager.run_client(scope, @name, run_opts)
scope << self
@global_scope = scope
@run_opts = run_opts
end

def keep_snapshot
Expand All @@ -37,10 +40,10 @@ def add_target_to_project
@target = Targets.new(self, @project, @tools, @pool).add_target_to_project
end

def run_tests
def run_tests(config)
@tests = Tests.new(self, @support, @project, @target, @tools)
@tests.list_tests(log: true)
@tests.run
@tests.run(config)
end

def create_package
Expand Down
6 changes: 5 additions & 1 deletion lib/setupmanagers/qemuhck/qemu_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,10 @@ def dump_commands
create_run_script(file_name, content.join)
end

def stop
@runner.vm_abort
end

def run(scope, run_opts = nil)
@run_opts = validate_run_opts(run_opts.to_h)
@keep_alive = run_opts[:keep_alive]
Expand All @@ -676,7 +680,7 @@ def run(scope, run_opts = nil)
scope.transaction do |tmp_scope|
hostfwd = Hostfwd.new(@options['slirp'], [@monitor_port, @vnc_port])
tmp_scope << hostfwd
Runner.new(tmp_scope, @logger, self, @run_name, @run_opts)
@runner = Runner.new(tmp_scope, @logger, self, @run_name, @run_opts)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/setupmanagers/qemuhck/qemuhck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def run_client(scope, name, run_opts = nil)
@clients_vm[name].run(scope, run_opts)
end

def stop_client(name)
@clients_vm[name].stop
end

def run_hck_studio(scope, run_opts)
HCKStudio.new(self, scope, run_opts) { @studio_vm.find_world_ip }
end
Expand Down

0 comments on commit 7cca5f3

Please sign in to comment.