oxidecomputer / oxidecomputer/hubris

`cargo xtask test` could take humility target as an argument

Open
#2,058 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.6k
Forks
239
Avg merge
1d 12h
Merged PRs (30d)
23

Description

When running cargo xtask test on a machine with multiple configured Humility targets, it's necessary to specify which target to run humility commands against. Unfortunately, the -- <extra args> argument cannot be used to pass --target targetname to Humility, as the target argument must come before the subcommand, and the -- <extra args> extra args are passed after the subcommand, and results in the xtask trying to run humility flash -t MYTARGET rather than humility -t MYTARGET flash, which humility dislikes:

eliza@theseus ~/Code/oxide/hubris $ cargo xtask test test/tests-gimletlet/app.toml -- -t gimletlet
    Finished `dev` profile [optimized + debuginfo] target(s) in 0.16s
     Running `target/debug/xtask test test/tests-gimletlet/app.toml -- -t gimletlet`
app.toml has changed; rebuilding all tasks
cleaning ["gimletlet", "test-runner", "test-suite", "test-assist", "test-idol-server", "task-hiffy", "task-idle"]
     Removed 136 files, 198.9MiB total
building crate test-runner
   Compiling abi v0.1.0 (/home/eliza/Code/oxide/hubris/sys/abi)
   Compiling test-runner v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-runner)
   Compiling userlib v0.1.0 (/home/eliza/Code/oxide/hubris/sys/userlib)
   Compiling test-api v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-api)
    Finished `release` profile [optimized + debuginfo] target(s) in 1.07s
target/thumbv7em-none-eabihf/release/test-runner -> target/tests-gimletlet/dist/runner.elf
building crate test-suite
   Compiling abi v0.1.0 (/home/eliza/Code/oxide/hubris/sys/abi)
   Compiling test-suite v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-suite)
   Compiling userlib v0.1.0 (/home/eliza/Code/oxide/hubris/sys/userlib)
   Compiling idol-runtime v0.1.0 (https://github.com/oxidecomputer/idolatry.git?branch=eliza/zerocopy-0.8#06a3c333)
   Compiling test-api v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-api)
   Compiling derive-idol-err v0.1.0 (/home/eliza/Code/oxide/hubris/lib/derive-idol-err)
   Compiling test-idol-api v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-idol-api)
cargo:rerun-if-env-changed=HUBRIS_TASK_CONFIG
    Finished `release` profile [optimized + debuginfo] target(s) in 1.51s
target/thumbv7em-none-eabihf/release/test-suite -> target/tests-gimletlet/dist/suite.elf
building crate test-assist
   Compiling abi v0.1.0 (/home/eliza/Code/oxide/hubris/sys/abi)
   Compiling test-assist v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-assist)
   Compiling userlib v0.1.0 (/home/eliza/Code/oxide/hubris/sys/userlib)
   Compiling test-api v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-api)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.83s
target/thumbv7em-none-eabihf/release/test-assist -> target/tests-gimletlet/dist/assist.elf
building crate test-idol-server
   Compiling test-idol-server v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-idol-server)
   Compiling userlib v0.1.0 (/home/eliza/Code/oxide/hubris/sys/userlib)
   Compiling idol-runtime v0.1.0 (https://github.com/oxidecomputer/idolatry.git?branch=eliza/zerocopy-0.8#06a3c333)
   Compiling test-idol-api v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-idol-api)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.87s
target/thumbv7em-none-eabihf/release/test-idol-server -> target/tests-gimletlet/dist/idol.elf
building crate task-hiffy
   Compiling userlib v0.1.0 (/home/eliza/Code/oxide/hubris/sys/userlib)
   Compiling gateway-messages v0.1.0 (https://github.com/oxidecomputer/management-gateway-service#3d7f1cb0)
   Compiling task-hiffy v0.1.0 (/home/eliza/Code/oxide/hubris/task/hiffy)
   Compiling drv-i2c-types v0.1.0 (/home/eliza/Code/oxide/hubris/drv/i2c-types)
   Compiling idol-runtime v0.1.0 (https://github.com/oxidecomputer/idolatry.git?branch=eliza/zerocopy-0.8#06a3c333)
   Compiling test-api v0.1.0 (/home/eliza/Code/oxide/hubris/test/test-api)
   Compiling drv-i2c-api v0.1.0 (/home/eliza/Code/oxide/hubris/drv/i2c-api)
   Compiling drv-spi-api v0.1.0 (/home/eliza/Code/oxide/hubris/drv/spi-api)
    Finished `release` profile [optimized + debuginfo] target(s) in 2.23s
target/thumbv7em-none-eabihf/release/task-hiffy -> target/tests-gimletlet/dist/hiffy.elf
building crate task-idle
   Compiling userlib v0.1.0 (/home/eliza/Code/oxide/hubris/sys/userlib)
   Compiling task-idle v0.1.0 (/home/eliza/Code/oxide/hubris/task/idle)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.43s
target/thumbv7em-none-eabihf/release/task-idle -> target/tests-gimletlet/dist/idle.elf
linking task 'runner'
linking task 'suite'
linking task 'assist'
linking task 'idol'
linking task 'hiffy'
linking task 'idle'
building crate gimletlet
   Compiling abi v0.1.0 (/home/eliza/Code/oxide/hubris/sys/abi)
   Compiling gimletlet v0.1.0 (/home/eliza/Code/oxide/hubris/app/gimletlet)
   Compiling kern v0.1.0 (/home/eliza/Code/oxide/hubris/sys/kern)
    Finished `release` profile [optimized + debuginfo] target(s) in 2.08s
target/thumbv7em-none-eabihf/release/gimletlet -> target/tests-gimletlet/dist/kernel
flash   = 0x08000000..0x08100000
ram     = 0x20000000..0x20020000
sram1_mac = 0x30000000..0x30010000
sram1   = 0x30010000..0x30020000
sram2   = 0x30020000..0x30040000
sram3   = 0x30040000..0x30048000
sram4   = 0x38000000..0x38010000
bank2   = 0x08100000..0x08200000
Used:
  flash:   0x18000 (9%)
  ram:     0x8500 (25%)
  sram1_mac: 0x0 (0%)
  sram1:   0x0 (0%)
  sram2:   0x0 (0%)
  sram3:   0x0 (0%)
  sram4:   0x0 (0%)
  bank2:   0x0 (0%)
error: Found argument '-t' which wasn't expected, or isn't valid in this context

        If you tried to supply `-t` as a value rather than a flag, use `-- -t`

USAGE:
    humility flash [OPTIONS]

For more information try --help
Error: humility failed

While it is possible to run cargo xtask test on a system with multiple humility targets using the HUMILITY_TARGET environment variable, it might be nice to also support -t as well..

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the cargo xtask test command entry point and inspect how HUMILITY_TARGET and extra arguments are handled before invoking humility flash. The change is done when a target such as -t gimletlet is accepted directly and passed before the Humility subcommand; verify the command's behavior with a configured target.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.