hwsim_utils.py 715 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/python
  2. #
  3. # hwsim testing utilities
  4. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  5. #
  6. # This software may be distributed under the terms of the BSD license.
  7. # See README for more details.
  8. import subprocess
  9. import logging
  10. logger = logging.getLogger(__name__)
  11. def test_connectivity(ifname1, ifname2):
  12. cmd = ["sudo",
  13. "../../mac80211_hwsim/tools/hwsim_test",
  14. ifname1,
  15. ifname2]
  16. try:
  17. s = subprocess.check_output(cmd)
  18. logger.debug(s)
  19. except subprocess.CalledProcessError, e:
  20. print "hwsim failed: " + str(e.returncode)
  21. print e.output
  22. raise
  23. def test_connectivity_p2p(dev1, dev2):
  24. test_connectivity(dev1.ifname, dev2.ifname)