nixos/test-driver: add Machine.record_audio#153916
nixos/test-driver: add Machine.record_audio#153916Synthetica9 wants to merge 7 commits intoNixOS:masterfrom
Conversation
|
@ofborg test pulseaudio.user pulseaudio.system firefox mpd |
|
Gonna draft this until #154168 is merged, so that'll probably take some time. If anyone wants this in earlier, let me know. |
cb3eb1d to
a29cf5a
Compare
a29cf5a to
ff63439
Compare
| bit_depth: int = 16, | ||
| channels: int = 2, | ||
| ) -> Iterator[None]: | ||
| filename = add_extension_if_simple_name(filename, "wav") |
There was a problem hiding this comment.
what do you think about simply enforcing that the user provided a sane filename and throwing a nice self-explaining exception otherwise?
There was a problem hiding this comment.
Oh I think something got lost in the rebase, but this is the same logic we use for screenshots. I factored out the function, but didn't use it for screenshot
| r"^\[(\d+)\]: Capturing audio\(\d+,\d+,\d+\) to (.*): (\d+) bytes$", | ||
| ) | ||
|
|
||
| def capture_info() -> Optional[Tuple[int, int]]: |
There was a problem hiding this comment.
reading this function feels like there is a lot of qemu-audio-capture specific domain logic and only a little bit of glue code that calls qemu-stuff and then throws it through the domain-specific code.
If you put the domain-specific part into a pure function, you would make it unit-testable and have test cases that at the same time document the interface that you expect from qemu. what do you think, does this make sense in your opinion, or do my ideas result in more work than value?
There was a problem hiding this comment.
I feel like it is already pretty testable by calling it in weird conditions (capture already running at the same filename, invalid arguments, "manually" stopping the capture, etc.)
Motivation for this change
Allows you to record audio from a VM and verify that sound actually played.
Depends on #153866
TODO:
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes