nix-vm-test icon indicating copy to clipboard operation
nix-vm-test copied to clipboard

Test driver crashes if special characters are present

Open dz0ny opened this issue 11 months ago • 1 comments

Describe the bug

A simple character in the output crashes the driver.

vm # qemu-kvm: terminating on signal 15 from pid 1046 (/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/bin/python3.11)
(finished: cleanup, in 0.03 seconds)
Traceback (most recent call last):
additionally exposed symbols:
    vm,
    vlan1,
    start_all, test_script, machines, vlans, driver, log, os, create_machine, subtest, run_tests, join_all, retry, serial_stdout_off, serial_stdout_on, polling_condition, Machine
  File "/nix/store/ifkgyf5n4i9sb23ic96l1g1r33zf0fag-nixos-test-driver-1.1/bin/.nixos-test-driver-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/ifkgyf5n4i9sb23ic96l1g1r33zf0fag-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/__init__.py", line 126, in main
    driver.run_tests()
  File "/nix/store/ifkgyf5n4i9sb23ic96l1g1r33zf0fag-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/driver.py", line 159, in run_tests
    self.test_script()
  File "/nix/store/ifkgyf5n4i9sb23ic96l1g1r33zf0fag-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/driver.py", line 151, in test_script
    exec(self.tests, symbols, None)
  File "<string>", line 3, in <module>
  File "/nix/store/ifkgyf5n4i9sb23ic96l1g1r33zf0fag-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/machine.py", line 703, in succeed
    (status, out) = self.execute(command, timeout=timeout)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/ifkgyf5n4i9sb23ic96l1g1r33zf0fag-nixos-test-driver-1.1/lib/python3.11/site-packages/test_driver/machine.py", line 642, in execute
    rc = int(self._next_newline_closed_block_from_shell().strip())
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Created symlink /etc/systemd/system/sockets.target.wants/pareto-core.socket → /etc/systemd/system/pareto-core.socket.'

To Reproduce

Activate systemd unit under Ubuntu VM.

Expected behavior

Should be able to parse and pass any string via test driver.

System information

Operating System: Linux Machine Type: 4x16 Architecture: amd64

Additional context

https://github.com/ParetoSecurity/pareto-core/actions/runs/13114941839/job/36586854338?pr=77#step:5:1636

dz0ny avatar Feb 03 '25 13:02 dz0ny

Related to https://github.com/numtide/nix-vm-test/issues/5 to some extent.

picnoir avatar Feb 06 '25 09:02 picnoir