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

Bring up previous session #487

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jedoku
Copy link
Contributor

@Jedoku Jedoku commented Oct 7, 2024

WIP

bin/auto_hck Fixed Show fixed Hide fixed
lib/project.rb Fixed Show fixed Hide fixed
lib/project.rb Fixed Show fixed Hide fixed
lib/project.rb Fixed Show fixed Hide fixed
lib/setupmanagers/qemuhck/qemu_machine.rb Fixed Show fixed Hide fixed
lib/setupmanagers/qemuhck/qemu_machine.rb Fixed Show fixed Hide fixed
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from a94ca1f to 71d5c6c Compare October 8, 2024 22:29
@akihikodaki
Copy link
Contributor

I'm not a fan of this idea. It brings significant complexity similar to --dump, which adds an alternative way to run tests.
Its use case is also unclear; I often repeatedly run tests using the command line history and I'm satisfied with it.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 71d5c6c to 7e1ff8a Compare October 18, 2024 15:48
lib/session.rb Outdated Show resolved Hide resolved
lib/setupmanagers/qemuhck/qemu_machine.rb Outdated Show resolved Hide resolved
lib/engines/hcktest/playlist.rb Outdated Show resolved Hide resolved
lib/engines/hcktest/tools.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 7e1ff8a to 8a79a7e Compare November 27, 2024 13:14
@Jedoku Jedoku requested a review from akihikodaki December 1, 2024 00:10
@Jedoku Jedoku changed the title RFC: Bring up previous session Bring up previous session Dec 2, 2024
lib/project.rb Outdated Show resolved Hide resolved
lib/session.rb Outdated Show resolved Hide resolved
lib/models/session.rb Outdated Show resolved Hide resolved
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 8a79a7e to 0ba68bc Compare December 19, 2024 08:54
@Jedoku Jedoku requested a review from akihikodaki December 19, 2024 09:06
lib/session.rb Outdated Show resolved Hide resolved
lib/session.rb Outdated Show resolved Hide resolved
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 72f53ca to dd5ec70 Compare January 22, 2025 09:01
@Jedoku Jedoku requested a review from akihikodaki January 22, 2025 11:17
lib/cli.rb Outdated Show resolved Hide resolved
lib/cli.rb Outdated Show resolved Hide resolved
lib/session.rb Outdated Show resolved Hide resolved
lib/models/session.rb Outdated Show resolved Hide resolved
lib/engines/hcktest/hcktest.rb Outdated Show resolved Hide resolved
lib/engines/hcktest/hcktest.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
lib/session.rb Outdated Show resolved Hide resolved
lib/models/session.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from a63b74b to 0f480a0 Compare January 30, 2025 03:51
@@ -274,7 +281,7 @@ def run_tests_with_config
next if tests.empty?

ResourceScope.open do |scope|
run_clients_and_configure_setup(scope, group => true, create_snapshot: false, boot_from_snapshot: true)
run_clients_and_configure_setup(scope, create_snapshot: false, group => true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this?

lib/engines/hcktest/hcktest.rb Outdated Show resolved Hide resolved
lib/session.rb Outdated Show resolved Hide resolved
lib/session.rb Outdated Show resolved Hide resolved
lib/cli.rb Outdated Show resolved Hide resolved
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 0f480a0 to df1cc61 Compare January 31, 2025 00:09
Copy link
Contributor

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation will leave an immature session if an error happens before clients get configured. Save the session after it is fully initialized (i.e., all clients are configured).

lib/cli.rb Outdated Show resolved Hide resolved
@Jedoku
Copy link
Contributor Author

Jedoku commented Jan 31, 2025

The current implementation will leave an immature session if an error happens before clients get configured. Save the session after it is fully initialized (i.e., all clients are configured).

But this is one of features, you can bring up VM`s for checking what's goin on and where it's crash

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from df1cc61 to 1684f10 Compare January 31, 2025 10:02
lib/cli.rb Outdated
Comment on lines 92 to 103
prop :svvp, T.nilable(T::Boolean)
prop :dump, T.nilable(T::Boolean)
prop :gthb_context_prefix, T.nilable(String)
prop :gthb_context_suffix, T.nilable(String)
prop :playlist, T.nilable(String)
prop :select_test_names, T.nilable(String)
prop :reject_test_names, T.nilable(String)
prop :reject_report_sections, T::Array[String], default: []
prop :boot_device, T.nilable(String)
prop :allow_test_duplication, T.nilable(T::Boolean)
prop :manual, T.nilable(T::Boolean)
prop :package_with_playlist, T.nilable(T::Boolean)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see any reason to make boolean fields nilable. String or Array can be nilable because we have logic to check is field specified or not. But in the case of a boolean, we always check true or false.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 606c9ec to e7b60b5 Compare January 31, 2025 11:03
@akihikodaki
Copy link
Contributor

The current implementation will leave an immature session if an error happens before clients get configured. Save the session after it is fully initialized (i.e., all clients are configured).

But this is one of features, you can bring up VM`s for checking what's goin on and where it's crash

The current code will make tests fail in an unpredictable manner instead of reproducing the past failure. It skips creating snapshots and configuration when restored so if some failure has happened in these operations, it will not reproduce the failure, but it will run the following tests with an immature configuration and pose different symptoms that are not useful to debug.

@Jedoku
Copy link
Contributor Author

Jedoku commented Feb 1, 2025 via email

@akihikodaki
Copy link
Contributor

It runs saved snapshots, and our VM's will be configured exactly as it was, also on we can open studio and see what happens in previous session

At least the session should be saved at least after snapshots are created, and if the VMs died before configuration, we should configure them before continuing to run tests.

The studio should have seen almost no activity at the early stage of execution before running tests; if it experienced a failure at the moment, it means the VM is so broken that it cannot boot or stay running for minutes. Such a scenario should be rare.

The easiest way to ensure the VMs are configured is simply to save the session after the configuration. It is sufficient to reproduce failures in tests.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from e7b60b5 to d0a7e85 Compare February 6, 2025 00:53
lib/project.rb Outdated Show resolved Hide resolved
def self.load_session(cli)
session = Models::Session.from_json_file("#{session_path(cli)}/session.json")

session.common.workspace_path = cli.common.workspace_path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is necessary.

lib/session.rb Outdated Show resolved Hide resolved
lib/models/session.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
lib/setupmanagers/qemuhck/qemu_machine.rb Outdated Show resolved Hide resolved
lib/project.rb Outdated Show resolved Hide resolved
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from d0a7e85 to c746b95 Compare February 11, 2025 01:52
@Jedoku Jedoku requested a review from akihikodaki February 11, 2025 01:56
Signed-off-by: Vitalii Chulak <vitalii@daynix.com>
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from c746b95 to af3e26e Compare February 11, 2025 02:44
@@ -45,7 +45,8 @@ def studio_vm_options
'image_name' => @platform['st_image'],
'logger' => @logger,
'iso_path' => @project.config['iso_path'],
'share_on_host_path' => @project.options.common.share_on_host_path
'share_on_host_path' => @project.options.common.share_on_host_path,
'configured' => @project.restored?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be in HCKTest as HCKTest coordinates to start VMs that are already configured. This logic is not valid for e.g., HCKInstall.

end

def parse(args)
left = @parser.order(args)
@mode = left.shift
@sub_parser[@mode]&.order!(left) unless @mode.nil?

restore_session if @test.latest_session || @test.session
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing self to AutoHCK::Session.load and letting it modify, let's pass the path to the session.
Such a method may be called from bin/auto_hck and return an instance of loaded CLI, which will replace the whole existing CLI instance.

So instead of having these lines in session.rb:

      cli.test = session.test
      cli.common = session.common

...add a line like the following in auto_hck:

cli = Session.load(session_path)

You don't have to list each attribute of CLI this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants