qtest: add test framework

The idea behind qtest is pretty simple.  Instead of executing a CPU via TCG or
KVM, rely on an external process to send events to the device model that the CPU
would normally generate.

qtest presents itself as an accelerator.  In addition, a new option is added to
establish a qtest server (-qtest) that takes a character device.  This is what
allows the external process to send CPU events to the device model.

qtest uses a simple line based protocol to send the events.  Documentation of
that protocol is in qtest.c.

I considered reusing the monitor for this job.  Adding interrupts would be a bit
difficult.  In addition, logging would also be difficult.

qtest has extensive logging support.  All protocol commands are logged with
time stamps using a new command line option (-qtest-log).  Logging is important
since ultimately, this is a feature for debugging.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
8 files changed
tree: c1ff5a6ed93543dd2580e11397d21ee190e3fd23
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. include/
  12. libcacard/
  13. linux-headers/
  14. linux-user/
  15. net/
  16. pc-bios/
  17. qapi/
  18. qga/
  19. QMP/
  20. qom/
  21. roms/
  22. scripts/
  23. slirp/
  24. sysconfigs/
  25. target-alpha/
  26. target-arm/
  27. target-cris/
  28. target-i386/
  29. target-lm32/
  30. target-m68k/
  31. target-microblaze/
  32. target-mips/
  33. target-ppc/
  34. target-s390x/
  35. target-sh4/
  36. target-sparc/
  37. target-unicore32/
  38. target-xtensa/
  39. tcg/
  40. tests/
  41. trace/
  42. ui/
  43. .gitignore
  44. .gitmodules
  45. .mailmap
  46. a.out.h
  47. acl.c
  48. acl.h
  49. aes.c
  50. aes.h
  51. aio.c
  52. alpha-dis.c
  53. alpha.ld
  54. arch_init.c
  55. arch_init.h
  56. arm-dis.c
  57. arm-semi.c
  58. arm.ld
  59. async.c
  60. balloon.c
  61. balloon.h
  62. bitmap.c
  63. bitmap.h
  64. bitops.c
  65. bitops.h
  66. block-migration.c
  67. block-migration.h
  68. block.c
  69. block.h
  70. block_int.h
  71. blockdev.c
  72. blockdev.h
  73. bswap.h
  74. bt-host.c
  75. bt-host.h
  76. bt-vhci.c
  77. buffered_file.c
  78. buffered_file.h
  79. cache-utils.c
  80. cache-utils.h
  81. Changelog
  82. cmd.c
  83. cmd.h
  84. CODING_STYLE
  85. compatfd.c
  86. compatfd.h
  87. compiler.h
  88. config.h
  89. configure
  90. console.c
  91. console.h
  92. COPYING
  93. COPYING.LIB
  94. coroutine-gthread.c
  95. coroutine-sigaltstack.c
  96. coroutine-ucontext.c
  97. coroutine-win32.c
  98. cpu-all.h
  99. cpu-common.h
  100. cpu-defs.h
  101. cpu-exec.c
  102. cpus.c
  103. cpus.h
  104. cris-dis.c
  105. cursor.c
  106. cursor_hidden.xpm
  107. cursor_left_ptr.xpm
  108. cutils.c
  109. def-helper.h
  110. device_tree.c
  111. device_tree.h
  112. dis-asm.h
  113. disas.c
  114. disas.h
  115. dma-helpers.c
  116. dma.h
  117. dyngen-exec.h
  118. elf.h
  119. envlist.c
  120. envlist.h
  121. error.c
  122. error.h
  123. error_int.h
  124. event_notifier.c
  125. event_notifier.h
  126. exec-all.h
  127. exec-memory.h
  128. exec-obsolete.h
  129. exec.c
  130. gdbstub.c
  131. gdbstub.h
  132. gen-icount.h
  133. HACKING
  134. hmp-commands.hx
  135. hmp.c
  136. hmp.h
  137. host-utils.c
  138. host-utils.h
  139. hppa-dis.c
  140. hppa.ld
  141. i386-dis.c
  142. i386.ld
  143. ia64-dis.c
  144. ia64.ld
  145. input.c
  146. int128.h
  147. iohandler.c
  148. ioport-user.c
  149. ioport.c
  150. ioport.h
  151. iorange.h
  152. iov.c
  153. iov.h
  154. json-lexer.c
  155. json-lexer.h
  156. json-parser.c
  157. json-parser.h
  158. json-streamer.c
  159. json-streamer.h
  160. kvm-all.c
  161. kvm-stub.c
  162. kvm.h
  163. libfdt_env.h
  164. LICENSE
  165. linux-aio.c
  166. m68k-dis.c
  167. m68k-semi.c
  168. m68k.ld
  169. main-loop.c
  170. main-loop.h
  171. MAINTAINERS
  172. Makefile
  173. Makefile.dis
  174. Makefile.hw
  175. Makefile.objs
  176. Makefile.target
  177. Makefile.user
  178. memory.c
  179. memory.h
  180. microblaze-dis.c
  181. migration-exec.c
  182. migration-fd.c
  183. migration-tcp.c
  184. migration-unix.c
  185. migration.c
  186. migration.h
  187. mips-dis.c
  188. mips.ld
  189. module.c
  190. module.h
  191. monitor.c
  192. monitor.h
  193. nbd.c
  194. nbd.h
  195. net.c
  196. net.h
  197. notify.c
  198. notify.h
  199. os-posix.c
  200. os-win32.c
  201. osdep.c
  202. osdep.h
  203. oslib-posix.c
  204. oslib-win32.c
  205. path.c
  206. pci-ids.txt
  207. pflib.c
  208. pflib.h
  209. poison.h
  210. posix-aio-compat.c
  211. ppc-dis.c
  212. ppc.ld
  213. ppc64.ld
  214. qapi-schema-guest.json
  215. qapi-schema-test.json
  216. qapi-schema.json
  217. qbool.c
  218. qbool.h
  219. qdict-test-data.txt
  220. qdict.c
  221. qdict.h
  222. qemu-aio.h
  223. qemu-barrier.h
  224. qemu-bridge-helper.c
  225. qemu-char.c
  226. qemu-char.h
  227. qemu-common.h
  228. qemu-config.c
  229. qemu-config.h
  230. qemu-coroutine-int.h
  231. qemu-coroutine-io.c
  232. qemu-coroutine-lock.c
  233. qemu-coroutine-sleep.c
  234. qemu-coroutine.c
  235. qemu-coroutine.h
  236. qemu-doc.texi
  237. qemu-error.c
  238. qemu-error.h
  239. qemu-file.h
  240. qemu-ga.c
  241. qemu-img-cmds.hx
  242. qemu-img.c
  243. qemu-img.texi
  244. qemu-io.c
  245. qemu-lock.h
  246. qemu-log.h
  247. qemu-nbd.c
  248. qemu-nbd.texi
  249. qemu-objects.h
  250. qemu-option.c
  251. qemu-option.h
  252. qemu-options-wrapper.h
  253. qemu-options.h
  254. qemu-options.hx
  255. qemu-os-posix.h
  256. qemu-os-win32.h
  257. qemu-progress.c
  258. qemu-queue.h
  259. qemu-sockets.c
  260. qemu-tech.texi
  261. qemu-thread-posix.c
  262. qemu-thread-posix.h
  263. qemu-thread-win32.c
  264. qemu-thread-win32.h
  265. qemu-thread.h
  266. qemu-timer-common.c
  267. qemu-timer.c
  268. qemu-timer.h
  269. qemu-tls.h
  270. qemu-tool.c
  271. qemu-user.c
  272. qemu-x509.h
  273. qemu-xattr.h
  274. qemu.sasl
  275. qemu_socket.h
  276. qerror.c
  277. qerror.h
  278. qfloat.c
  279. qfloat.h
  280. qint.c
  281. qint.h
  282. qjson.c
  283. qjson.h
  284. qlist.c
  285. qlist.h
  286. qmp-commands.hx
  287. qmp.c
  288. qobject.h
  289. qstring.c
  290. qstring.h
  291. qtest.c
  292. qtest.h
  293. range.h
  294. readline.c
  295. readline.h
  296. README
  297. rules.mak
  298. s390-dis.c
  299. s390.ld
  300. savevm.c
  301. sh4-dis.c
  302. softmmu-semi.h
  303. softmmu_defs.h
  304. softmmu_exec.h
  305. softmmu_header.h
  306. softmmu_template.h
  307. sparc-dis.c
  308. sparc.ld
  309. sparc64.ld
  310. spice-qemu-char.c
  311. sysemu.h
  312. targphys.h
  313. tcg-runtime.c
  314. tci-dis.c
  315. tci.c
  316. thunk.c
  317. thunk.h
  318. TODO
  319. trace-events
  320. translate-all.c
  321. uboot_image.h
  322. user-exec.c
  323. VERSION
  324. version.rc
  325. vgafont.h
  326. vl.c
  327. vmstate.h
  328. x86_64.ld
  329. xen-all.c
  330. xen-mapcache.c
  331. xen-mapcache.h
  332. xen-stub.c
  333. xtensa-semi.c