Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python test driver #77693

Merged
merged 2 commits into from Jan 14, 2020
Merged

Conversation

erikarvstedt
Copy link
Member

@erikarvstedt erikarvstedt commented Jan 14, 2020

Trigger bug that's fixed by test-driver.py: specify coreutils dependency:

# Run driver with empty PATH.
# Output: "nixos-test-driver: line 2: cat: command not found"
env -i tests="" $(nix-build --no-out-link "nixpkgs/nixos/tests/haka.nix" -A driver)/bin/nixos-test-driver
# remove vde dir
rm -r vde1.ctl

Trigger bug that's fixed by test-driver.py: fix decoding of VM output:

# Fails with UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 15-16: truncated \xXX escape
nix-build --no-out-link - <<'EOF'
import nixpkgs/nixos/tests/make-test-python.nix {
  machine.boot.initrd.preDeviceCommands = "echo 'decoding test: \\\\x λ'";
  testScript = ''
    machine.succeed("true")
  '';
}
EOF

cc @tfc

Otherwise the driver script fails when coreutils are not in PATH.
The codec format 'unicode_escape' was introduced in 52ee102 to handle
undecodable bytes in boot menus.

This made the problem worse as unicode chars outside of iso-8859-1
produce garbled output and valid utf-8 strings (such as "\x" ) trigger
decoding errors.

Fix this by using the default 'utf-8' codec and by explicitly ignoring
decoding errors.
@jonringer
Copy link
Contributor

@GrahamcOfBorg test networking.scripted

just want to make sure something weird doesn't happen

@jonringer jonringer merged commit 5bdb653 into NixOS:master Jan 14, 2020
@erikarvstedt erikarvstedt deleted the fix-py-test-driver branch January 15, 2020 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants