test_00_system.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from __future__ import print_function
  2. import subprocess
  3. import pytest
  4. import rostest.util as u
  5. @pytest.fixture(scope="module")
  6. def qemu(request):
  7. return u.run_qemu(request)
  8. @pytest.mark.timeout(30)
  9. def test_system_boot(qemu):
  10. u.flush_out(qemu.stdout)
  11. busybox = {'amd64': 'busybox', 'arm': 'armhf/busybox', 'arm64': 'aarch64/busybox'}
  12. @pytest.mark.timeout(60)
  13. def test_run_system_container(qemu):
  14. u.wait_for_ssh(qemu)
  15. ssh = subprocess.Popen(
  16. './scripts/ssh --qemu sudo system-docker run --rm ' + busybox[u.arch] + ' /bin/true',
  17. shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
  18. for ln in u.iter_lines(ssh.stdout):
  19. print(ln)
  20. ssh.wait()
  21. assert ssh.returncode == 0
  22. @pytest.mark.timeout(60)
  23. def test_ros_dev(qemu):
  24. u.wait_for_ssh(qemu)
  25. ssh = subprocess.Popen(
  26. './scripts/ssh --qemu sudo ros dev',
  27. shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
  28. for ln in u.iter_lines(ssh.stdout):
  29. print(ln)
  30. ssh.wait()
  31. assert ssh.returncode == 0