bootimage icon indicating copy to clipboard operation
bootimage copied to clipboard

Cannot run tests on CLion

Open gerritsangel opened this issue 4 years ago • 2 comments

I think bootimage has some problems with the custom test runner on CLion/Rust plugin.

CLion can create a Cargo run configuration for tests. This creates the following cargo command:

C:/Programming/Rust/cargo/bin/cargo.exe test --color=always --no-fail-fast -- -Z unstable-options --format=json --show-output

Unfortunately, the arguments after -- are passed to qemu as is

Running: `qemu-system-x86_64 -drive format=raw,file=C:\dev\Workspace\gerrix\target\x86_64-blog_os\debug\deps\bootimage-gerrix-d6bdb98945edd169.bin -no-reboot -device isa-debug-exit,iobase=0xf4,iosize=0x04 -Z unstable-options --format=json --show-output`
qemu-system-x86_64: -Z: invalid option

Running the test via cargo test works, though.

gerritsangel avatar Jan 31 '21 19:01 gerritsangel

It looks like CLion only supports Rust's built-in test runner. I don't think that it would make sense to filter out the --format=json etc arguments in bootimage because the output format would still be incompatible if CLion expects some specific JSON output.

It's probably also worth mentioning that I'm planning to release a new bootloader version that does no longer require bootimage at all and instead lets user define their own small "runner" crates. This should allow you to adjust your runner exactly as you need, including the QEMU arguments.

phil-opp avatar Feb 02 '21 11:02 phil-opp

Rust plugin uses its test tool window to perform tests. It needs cargo test JSON output to show it there, and adds this flag implicitly on test.

As a workaround, you can make an alias to test command in .cargo/config.toml and avoid Rust plugin to add --format=json to the command. Then, use cargo t in cargo run configuration.

[alias]
t = "test"

avrong avatar Sep 24 '21 20:09 avrong