Skip to content

nixosTests.sway: don't use ORC#238997

Merged
vcunat merged 2 commits intoNixOS:masterfrom
Synthetica9:swaytest-no-orc
Jun 22, 2023
Merged

nixosTests.sway: don't use ORC#238997
vcunat merged 2 commits intoNixOS:masterfrom
Synthetica9:swaytest-no-orc

Conversation

@Synthetica9
Copy link
Member

Description of changes

Factor out ORC. Also don't time out the gpg-agent. Should fix #238642

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Jun 21, 2023
@Synthetica9 Synthetica9 requested a review from primeos June 21, 2023 14:11
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jun 21, 2023
Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

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

It basically seems fine to me but would you mind briefly documenting in the commit message why we're making these changes (1-2 sentences and a link to #238642 should be enough)? Commit messages / documentation is important to me. I can also take care of it if you don't want.

And did you test if everything looks fine with a Nixpkgs revision where the OCR part fails? I'm asking because it could fail for good reasons. I'm also not keen on removing OCR tbh. It was never required but it always provided the extra security that the text rendering works properly (this already caused issues in the past - with Chromium as well). But we can certainly drop the OCR support for now as long as someone can confirm that only the OCR is the issue.

};

etc."gpg-agent.conf".text = ''
pinentry-timeout 86400
Copy link
Member

Choose a reason for hiding this comment

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

It'd be great if we could document this change (either here via a comment or via the commit message) - otherwise it might not be clear / obvious enough in the future.

I also checked the man page but the timeout seems to come from pinentry-gnome3:

--pinentry-timeout n
This option asks the Pinentry to timeout after n seconds with no user input. The default value of 0 does not ask the pinentry to timeout, however a Pinentry may use its own default timeout
value in this case. A Pinentry may or may not honor this request.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yeah I tried that but it didn't work with 0 (which was with the first value I tried), but I didn't retry with a large positive value... I'll investigate

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I tried this again and it just doesn't come up. Seems like the config file is really needed.

import shlex
import json

q = shlex.quote
Copy link
Member

Choose a reason for hiding this comment

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

Hm, not sure about this but I can live with it.
from shlex import quote (or from shlex import quote as q) would probably be nicer.

NODE_GROUPS = ["nodes", "floating_nodes"]


def swaymsg(command: str = "", succeed=True, type="command"):
Copy link
Member

@primeos primeos Jun 21, 2023

Choose a reason for hiding this comment

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

Optional: A docstring would be nice (but the function is well readable so it's not required).
For the other two functions it'd be a bit more useful.


return any(pattern in name for name in nodes)

retry(func)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure how safe it is to rely on retry being available but it should be fine given that other tests also already rely on it.

Comment on lines +161 to +162
swaymsg("exec mkdir -p ~/.gnupg")
swaymsg("exec cp /etc/gpg-agent.conf ~/.gnupg")
Copy link
Member

Choose a reason for hiding this comment

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

That's a bit unfortunate but the package seems to use sysconfdir=${gnupg}/etc/gnupg so it's fine for now.

swaymsg("exec mkdir -p ~/.gnupg")
swaymsg("exec cp /etc/gpg-agent.conf ~/.gnupg")

swaymsg("exec DISPLAY=INVALID gpg --no-tty --yes --quick-generate-key test", succeed=False)
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need the succeed=False here and do you know why it returns an unsuccessful exit code?

machine.wait_until_succeeds("pgrep --exact gpg")
machine.wait_for_text("Passphrase")
wait_for_window("gpg")
machine.succeed("pgrep --exact gpg")
Copy link
Member

Choose a reason for hiding this comment

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

Hm, it's fine but is this really useful again after waiting for the window (since we already ensured that the process is there before waiting for the window)?

before = get_height()
machine.send_key("alt-shift-e")
machine.wait_for_text("You pressed the exit shortcut.")
retry(lambda _: get_height() < before)
Copy link
Member

Choose a reason for hiding this comment

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

It's fine but a bit of a weird test. Would seem better if we could use wait_for_window but I haven't tested if and how it gets listed there.

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't show up in the window list, this was the best thing I could think of.

@vcunat
Copy link
Member

vcunat commented Jun 22, 2023

Thanks. Given that nixos-unstable is on a five day old commit, let me merge this early. That should not prevent you from further work and discussion on improving the test.

EDIT: I think in-code comments are usually better than detailed commit messages.

@vcunat vcunat merged commit e603dc5 into NixOS:master Jun 22, 2023
@vcunat vcunat mentioned this pull request Jun 22, 2023
3 tasks
@@ -45,6 +45,10 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
regular2 = foreground;
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this now, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the entire foot config I think (unless we want to return to ORC? Not sure how common font rendering issues are vs. how finicky ORC is (doesn't work reliably in interactive mode, etc.))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sway test flaky, blocks channel updates

4 participants