Skip to content

Enable some old expectedFailures for qvm_run#471

Open
ben-grande wants to merge 1 commit into
QubesOS:mainfrom
ben-grande:fix-old-run-dash
Open

Enable some old expectedFailures for qvm_run#471
ben-grande wants to merge 1 commit into
QubesOS:mainfrom
ben-grande:fix-old-run-dash

Conversation

@ben-grande

@ben-grande ben-grande commented May 26, 2026

Copy link
Copy Markdown
Contributor

For: QubesOS/qubes-issues#2916


Didn't test on my system. Relying on unit tests.

with subprocess.Popen(
["echo", "some-data"], stdout=subprocess.PIPE
) as echo:
with unittest.mock.patch("sys.stdin", echo.stdout):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why remove this? Cause later its already testing is stdin, stdout and stderr are None.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted this, not sure if I should touch that in this PR or commit. Maybe call a subprocess for shell and pass stdin that way, and capture stdout and stderr also that way?

@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.84%. Comparing base (64cd714) to head (5748465).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #471   +/-   ##
=======================================
  Coverage   76.83%   76.84%           
=======================================
  Files          53       53           
  Lines        9365     9363    -2     
=======================================
- Hits         7196     7195    -1     
+ Misses       2169     2168    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

(
"@dispvm:test-vm",
"qubes.VMExec+----",
"qubes.VMExec+----+----",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is correct. -- (the first one) means end of options, it shouldn't be considered part of the command itself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In this case, yes. Old one was correct.

(
"@dispvm:test-vm",
"qubes.VMExec+command+----",
"qubes.VMExec+command+----+----",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And here too, the old behavior was correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Command: ["--no-gui", "--dispvm=test-vm", "command", "--", "--"].

So when the command command is already the first positional argument, everything else should be passed to the VMExec and not be trimmed by qvm-run.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

-- is "end of options" marker, not "start of positional arguments" marker. It only means options shouldn't be interpreted after it, nothing more. See POSIX spec (Guideline 10).
See for example behavior of ls:

  • ls - l foo -- bar
  • ls foo -l -- -- bar
  • ls foo -- bar -l

That said, qvm-run already enforces all options to be passed before the command (for example qvm-run VM ls -p is not the same as qvm-run -p VM ls). So, maybe indeed in this case your approach is more consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is hard to do with argparse. It eats "--" anywhere even though option arguments are not allowed anymore at the place "--" is, because a preceding positional argument exists. Marking this as draft, but probably won't be solved.

self.app.expected_calls[
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'os', None)
] = b"2\x00QubesFeatureNotFoundError\x00\x00Feature 'os' not set\x00"
stdout = io.StringIO()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is unused after your change (the assert at the end is pointless with the mock.patch removed).

@ben-grande
ben-grande marked this pull request as draft June 10, 2026 08:47
@ben-grande

Copy link
Copy Markdown
Contributor Author

The dash-dash handling is haunted, I will drop the changes related to that so only the normal skipped tests can be enabled again and the issue can be closed.

@ben-grande
ben-grande marked this pull request as ready for review July 20, 2026 16:38
@ben-grande ben-grande changed the title Enable skipped tests and fix dash dash parse bug Enable some old expectedFailures for qvm_run Jul 20, 2026
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