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

PHD: several cargo xtask phd CLI fixes #642

Merged
merged 5 commits into from
Feb 15, 2024
Merged

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Feb 14, 2024

This branch fixes a bunch of things that were broken and/or annoying about the cargo xtask phd CLI user experience. In particular, I've made the following changes:

  • PHD: don't require -- in xtask arg passthrough (a573d79)

    Currently, cargo xtask phd requires a -- delimiter prior to any
    arguments that are passed through to phd-runner. This is a bit
    unfortunate, as the command invocation accepts some arguments that are
    consumed by the xtask command, and others that are passed through to
    phd-runner. This commit adds allow_hyphen_values to the trailing
    varargs in the Clap CLI for cargo xtask phd, so that the user doesn't
    need to explicitly pass the -- delimiter. This makes the CLI a bit
    nicer to use.

  • PHD: add cargo xtask phd run --no-base-propolis (f6913ca)

    Currently, there's no way to disable the migration-from-base tests in
    cargo xtask phd run, only set where the base Propolis artifact comes
    from. This branch adds a --no-base-propolis flag to cargo xtask phd run so that migration-from-base tests can be skipped entirely, the way
    they can with a raw phd-runner invocation.

  • PHD: allow overriding base commit with xtask phd (03a64f6)

    Currently, cargo xtask phd accepts a custom --base-propolis-branch
    argument, and doesn't automatically populate that argument if it's
    provided. However, it doesn't support the --base-propolis-commit or
    --base-propolis-cmd arguments at all, and if they are present, cargo xtask phd will still pass --base-propolis-branch to phd-runner,
    causing a conflict between the --base-propolis-branch and
    --base-propolis-commit/--base-propolis-cmd args. This means that
    it's impossible to use cargo xtask phd with an explicit base commit or
    local base binary.

    This commit fixes that, by changing cargo xtask phd run to also look
    for those arguments, and skip setting the default
    --base-propolis-branch if either are present.

  • PHD: fix cargo xtask phd list not doing that (882a034)

    The cargo xtask phd list subcommand is currently broken, as it doesn't
    actually pass the list subcommand to phd-runner --- it just passes
    through any trailing args. So, running cargo xtask phd list gets you

    $ cargo xtask phd list
       Compiling phd-runner
        Finished phd-runner dev [unoptimized + debuginfo] in 19.78s
         Running target/x86_64-unknown-illumos/debug/phd-runner
    Runtime configuration options for the runner.
    
    Usage: phd-runner [OPTIONS] <COMMAND>
    
    Commands:
      run
      list
      help  Print this message or the help of the given subcommand(s)
    
    Options:
          --disable-ansi  Suppress emission of terminal control codes in the runner's log output
          --emit-bunyan   Emit Bunyan-formatted logs
      -h, --help          Print help

    rather than actually listing tests.

    This commit fixes that by actually passing the list subcommand to
    phd-runner before any trailing args. Now, it works:

    $ cargo xtask phd list
        Compiling phd-runner
        Finished phd-runner dev [unoptimized + debuginfo] in 0.44s
         Running target/x86_64-unknown-illumos/debug/phd-runner list
    2024-02-14T20:47:45.015748Z  INFO phd_runner: 35: runner_args=ProcessArgs { command: List(ListOptions { include_filter: [], exclude_filter: [] }), disable_ansi: false, em it_bunyan: false }
    Tests enabled after applying filters:
    
        phd_tests::smoke::instance_spec_get_test
        phd_tests::smoke::nproc_test
        phd_tests::migrate::from_base::migration_from_base_and_back
        phd_tests::migrate::from_base::serial_history
        phd_tests::migrate::from_base::can_migrate_from_base
        phd_tests::server_state_machine::instance_reset_requires_running_test
        phd_tests::server_state_machine::instance_reset_test
        phd_tests::server_state_machine::instance_stop_causes_destroy_test
        phd_tests::server_state_machine::instance_start_stop_test
        phd_tests::migrate::running_process::export_failure
        phd_tests::migrate::running_process::import_failure
        phd_tests::migrate::running_process::migrate_running_process
        phd_tests::hw::lspci_lifecycle_test
        phd_tests::framework::multiline_serial_test
        phd_tests::crucible::migrate::load_test
        phd_tests::crucible::migrate::smoke_test
        phd_tests::crucible::smoke::shutdown_persistence_test
        phd_tests::crucible::smoke::boot_test
        phd_tests::migrate::multiple_migrations
        phd_tests::migrate::incompatible_vms
        phd_tests::migrate::serial_history
        phd_tests::migrate::smoke_test
    
      22 test(s) selected

    My bad!

The `cargo xtask phd list` subcommand is currently broken, as it doesn't
actually pass the `list` subcommand to `phd-runner` --- it just passes
through any trailing args. So, running `cargo xtask phd list` gets you

```console
$ cargo xtask phd list
   Compiling phd-runner
    Finished phd-runner dev [unoptimized + debuginfo] in 19.78s
     Running target/x86_64-unknown-illumos/debug/phd-runner
Runtime configuration options for the runner.

Usage: phd-runner [OPTIONS] <COMMAND>

Commands:
  run
  list
  help  Print this message or the help of the given subcommand(s)

Options:
      --disable-ansi  Suppress emission of terminal control codes in the runner's log output
      --emit-bunyan   Emit Bunyan-formatted logs
  -h, --help          Print help
```

rather than actually listing tests.

This commit fixes that by actually passing the `list` subcommand to
`phd-runner` before any trailing args. Now, it works:

```console
$ cargo xtask phd list
    Compiling phd-runner
    Finished phd-runner dev [unoptimized + debuginfo] in 0.44s
     Running target/x86_64-unknown-illumos/debug/phd-runner list
2024-02-14T20:47:45.015748Z  INFO phd_runner: 35: runner_args=ProcessArgs { command: List(ListOptions { include_filter: [], exclude_filter: [] }), disable_ansi: false, emit_bunyan: false }
Tests enabled after applying filters:

    phd_tests::smoke::instance_spec_get_test
    phd_tests::smoke::nproc_test
    phd_tests::migrate::from_base::migration_from_base_and_back
    phd_tests::migrate::from_base::serial_history
    phd_tests::migrate::from_base::can_migrate_from_base
    phd_tests::server_state_machine::instance_reset_requires_running_test
    phd_tests::server_state_machine::instance_reset_test
    phd_tests::server_state_machine::instance_stop_causes_destroy_test
    phd_tests::server_state_machine::instance_start_stop_test
    phd_tests::migrate::running_process::export_failure
    phd_tests::migrate::running_process::import_failure
    phd_tests::migrate::running_process::migrate_running_process
    phd_tests::hw::lspci_lifecycle_test
    phd_tests::framework::multiline_serial_test
    phd_tests::crucible::migrate::load_test
    phd_tests::crucible::migrate::smoke_test
    phd_tests::crucible::smoke::shutdown_persistence_test
    phd_tests::crucible::smoke::boot_test
    phd_tests::migrate::multiple_migrations
    phd_tests::migrate::incompatible_vms
    phd_tests::migrate::serial_history
    phd_tests::migrate::smoke_test

22 test(s) selected
```

My bad!
Currently, `cargo xtask phd` accepts a custom `--base-propolis-branch`
argument, and doesn't automatically populate that argument if it's
provided. However, it doesn't support the `--base-propolis-commit` or
`--base-propolis-cmd` arguments at all, and if they are present, `cargo
xtask phd` will still pass `--base-propolis-branch` to `phd-runner`,
causing a conflict between the `--base-propolis-branch` and
`--base-propolis-commit`/`--base-propolis-cmd` args. This means that
it's impossible to use `cargo xtask phd` with an explicit base commit or
local base binary.

This commit fixes that, by changing `cargo xtask phd run` to also look
for those arguments, and skip setting the default
`--base-propolis-branch` if either are present.
Currently, there's no way to *disable* the migration-from-base tests in
`cargo xtask phd run`, only set where the base Propolis artifact comes
from. This branch adds a `--no-base-propolis` flag to `cargo xtask phd
run` so that migration-from-base tests can be skipped entirely, the way
they can with a raw `phd-runner` invocation.
Currently, `cargo xtask phd` requires a `--` delimiter prior to any
arguments that are passed through to `phd-runner`. This is a bit
unfortunate, as the command invocation accepts some arguments that are
consumed by the xtask command, and others that are passed through to
`phd-runner`. This commit adds [`allow_hyphen_values`] to the trailing
varargs in the Clap CLI for `cargo xtask phd`, so that the user doesn't
need to explicitly pass the `--` delimiter. This makes the CLI a bit
nicer to use.

[`allow_hyphen_values`]: https://docs.rs/clap/latest/clap/struct.Arg.html#method.allow_hyphen_values
@hawkw hawkw requested a review from gjcolombo February 14, 2024 21:12
Copy link
Contributor

@gjcolombo gjcolombo left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes!

Co-authored-by: Greg Colombo <greg@oxidecomputer.com>
@hawkw hawkw merged commit 206cee8 into master Feb 15, 2024
@hawkw hawkw deleted the eliza/xtask-phd-cli-polish branch February 15, 2024 00:35
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.

2 participants