qemu-irix/tests
Eduardo Habkost 0679f98b40 docker: Handle exceptions when looking for docker command
When trying to run docker tests on a host without the docker
command,  we get the following Python backtrace:

  $ make docker-test-quick@centos6 V=1
  .../qemu/tests/docker/docker.py build qemu:centos6 .../qemu/tests/docker/dockerfiles/centos6.docker
  Traceback (most recent call last):
    File ".../qemu/tests/docker/docker.py", line 339, in <module>
      sys.exit(main())
    File ".../qemu/tests/docker/docker.py", line 336, in main
      return args.cmdobj.run(args, argv)
    File ".../qemu/tests/docker/docker.py", line 231, in run
      dkr = Docker()
    File ".../qemu/tests/docker/docker.py", line 98, in __init__
      self._command = _guess_docker_command()
    File ".../qemu/tests/docker/docker.py", line 41, in _guess_docker_command
      stdout=DEVNULL, stderr=DEVNULL) == 0:
    File "/usr/lib64/python2.7/subprocess.py", line 523, in call
      return Popen(*popenargs, **kwargs).wait()
    File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
      errread, errwrite)
    File "/usr/lib64/python2.7/subprocess.py", line 1343, in _execute_child
      raise child_exception
  OSError: [Errno 2] No such file or directory
  .../qemu/tests/docker/Makefile.include:47: recipe for target 'docker-image-centos6' failed
  make: *** [docker-image-centos6] Error 1

Change _guess_docker_command() to handle OSError exceptions
raised by subprocess.call(), so we will keep looking for other
commands and print a better error message.

New output will be:

  $ make docker-test-quick@centos6 V=1
  .../qemu/tests/docker/docker.py build qemu:centos6 .../qemu/tests/docker/dockerfiles/centos6.docker
  Traceback (most recent call last):
    File ".../qemu/tests/docker/docker.py", line 343, in <module>
      sys.exit(main())
    File ".../qemu/tests/docker/docker.py", line 340, in main
      return args.cmdobj.run(args, argv)
    File ".../qemu/tests/docker/docker.py", line 235, in run
      dkr = Docker()
    File ".../qemu/tests/docker/docker.py", line 102, in __init__
      self._command = _guess_docker_command()
    File ".../qemu/tests/docker/docker.py", line 49, in _guess_docker_command
      commands_txt)
  Exception: Cannot find working docker command. Tried:
    docker
    sudo -n docker
  .../qemu/tests/docker/Makefile.include:47: recipe for target 'docker-image-centos6' failed
  make: *** [docker-image-centos6] Error 1

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1474369559-16903-1-git-send-email-ehabkost@redhat.com>
[exceptions.OSError -> OSError and drop the import. - Fam]
Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-23 11:38:57 +08:00
..
acpi-test-data
data
docker docker: Handle exceptions when looking for docker command 2016-09-23 11:38:57 +08:00
guest-debug
image-fuzzer
libqos tests: fix qvirtqueue_kick 2016-09-13 11:00:57 +01:00
migration
multiboot
qapi-schema
qemu-iotests iotest 055: refactor and speed up 2016-09-20 22:12:57 +02:00
rocker
tcg
vmstate-static-checker-data
.gitignore tests: add unit test case for replication 2016-09-13 11:00:56 +01:00
Makefile.include tests: virtio-9p: add basic configuration test 2016-09-16 12:15:56 +02:00
ac97-test.c
ahci-test.c
bios-tables-test.c tests/acpi: speedup acpi tests 2016-09-10 00:08:28 +03:00
boot-order-test.c
boot-sector.c
boot-sector.h
boot-serial-test.c
check-block.sh
check-qdict.c
check-qfloat.c
check-qint.c
check-qjson.c
check-qlist.c
check-qnull.c
check-qom-interface.c
check-qom-proplist.c
check-qstring.c
crypto-tls-x509-helpers.c
crypto-tls-x509-helpers.h crypto: fix building complaint 2016-09-12 12:00:52 +01:00
device-introspect-test.c
display-vga-test.c
drive_del-test.c
ds1338-test.c
e1000-test.c
e1000e-test.c
eepro100-test.c
endianness-test.c
es1370-test.c
fdc-test.c
fw_cfg-test.c
hd-geo-test.c
i440fx-test.c
i82801b11-test.c
ide-test.c
intel-hda-test.c
io-channel-helpers.c
io-channel-helpers.h
ioh3420-test.c
ipmi-bt-test.c
ipmi-kcs-test.c
ipoctal232-test.c
ivshmem-test.c
libqtest.c tests: add qtest_add_data_func_full 2016-09-08 18:05:22 +04:00
libqtest.h tests: add qtest_add_data_func_full 2016-09-08 18:05:22 +04:00
m48t59-test.c
ne2000-test.c
nvme-test.c
pc-cpu-test.c tests: pc-cpu-test leaks fixes 2016-09-08 18:05:22 +04:00
pcnet-test.c
pkix_asn1_tab.c
postcopy-test.c tests: fix postcopy-test leaks 2016-09-08 18:05:22 +04:00
prom-env-test.c
pvpanic-test.c
pxe-test.c
q35-test.c
qemu-iotests-quick.sh
qht-bench.c
qom-test.c tests: fix qom-test leaks 2016-09-08 18:05:21 +04:00
rcutorture.c
rtc-test.c
rtl8139-test.c
spapr-phb-test.c
tco-test.c
test-aio.c
test-base64.c
test-bitops.c
test-blockjob-txn.c
test-blockjob.c
test-bufferiszero.c cutils: Add test for buffer_is_zero 2016-09-13 19:13:32 +02:00
test-clone-visitor.c
test-coroutine.c
test-crypto-afsplit.c
test-crypto-block.c
test-crypto-cipher.c crypto: ensure XTS is only used with ciphers with 16 byte blocks 2016-09-12 12:00:06 +01:00
test-crypto-hash.c
test-crypto-ivgen.c
test-crypto-pbkdf.c crypto: support more hash algorithms for pbkdf 2016-09-19 16:30:45 +01:00
test-crypto-secret.c
test-crypto-tlscredsx509.c
test-crypto-tlssession.c
test-crypto-xts.c
test-cutils.c
test-filter-mirror.c
test-filter-redirector.c
test-hbitmap.c
test-int128.c
test-io-channel-buffer.c
test-io-channel-command.c
test-io-channel-file.c
test-io-channel-socket.c
test-io-channel-tls.c
test-io-task.c
test-iov.c
test-logging.c
test-mul64.c
test-netfilter.c
test-opts-visitor.c
test-qdev-global-props.c
test-qdist.c
test-qemu-opts.c
test-qga.c tests: add a test to check invalid args 2016-09-19 17:32:22 +02:00
test-qht-par.c
test-qht.c
test-qmp-commands.c qapi: check invalid arguments on no-args commands 2016-09-19 17:32:22 +02:00
test-qmp-event.c
test-qmp-input-strict.c
test-qmp-input-visitor.c
test-qmp-output-visitor.c
test-rcu-list.c
test-replication.c tests: add unit test case for replication 2016-09-13 11:00:56 +01:00
test-rfifolock.c
test-string-input-visitor.c
test-string-output-visitor.c
test-thread-pool.c
test-throttle.c
test-timed-average.c
test-visitor-serialization.c
test-vmstate.c
test-write-threshold.c
test-x86-cpuid.c
test-xbzrle.c
tmp105-test.c
tpci200-test.c
usb-hcd-ehci-test.c
usb-hcd-ohci-test.c
usb-hcd-uhci-test.c
usb-hcd-xhci-test.c
vhost-user-bridge.c
vhost-user-test.c
virtio-9p-test.c tests: virtio-9p: add basic configuration test 2016-09-16 12:15:56 +02:00
virtio-balloon-test.c
virtio-blk-test.c
virtio-console-test.c
virtio-net-test.c
virtio-rng-test.c
virtio-scsi-test.c
virtio-serial-test.c
vmxnet3-test.c
wdt_ib700-test.c