One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
qemu-kvm
/
devel
/
View File Name :
qtest.html
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>QTest Device Emulation Testing Framework — QEMU qemu-kvm-6.2.0-53.module+el8.10.0+2055+8eb7870b.4 documentation</title> <link rel="shortcut icon" href="../_static/qemu_32x32.png"/> <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="Qtest Driver Framework" href="qgraph.html" /> <link rel="prev" title="CI" href="ci.html" /> <script src="../_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="../index.html" class="icon icon-home"> QEMU <img src="../_static/qemu_128x128.png" class="logo" alt="Logo"/> </a> <div class="version"> 6.2.0 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <p class="caption"><span class="caption-text">Contents:</span></p> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../about/index.html">About QEMU</a></li> <li class="toctree-l1"><a class="reference internal" href="../system/index.html">System Emulation</a></li> <li class="toctree-l1"><a class="reference internal" href="../user/index.html">User Mode Emulation</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../interop/index.html">System Emulation Management and Interoperability</a></li> <li class="toctree-l1"><a class="reference internal" href="../specs/index.html">System Emulation Guest Hardware Specifications</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Developer Information</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="code-of-conduct.html">Code of Conduct</a></li> <li class="toctree-l2"><a class="reference internal" href="conflict-resolution.html">Conflict Resolution Policy</a></li> <li class="toctree-l2"><a class="reference internal" href="build-system.html">The QEMU build system architecture</a></li> <li class="toctree-l2"><a class="reference internal" href="style.html">QEMU Coding Style</a></li> <li class="toctree-l2"><a class="reference internal" href="kconfig.html">QEMU and Kconfig</a></li> <li class="toctree-l2"><a class="reference internal" href="testing.html">Testing in QEMU</a></li> <li class="toctree-l2"><a class="reference internal" href="fuzzing.html">Fuzzing</a></li> <li class="toctree-l2"><a class="reference internal" href="control-flow-integrity.html">Control-Flow Integrity (CFI)</a></li> <li class="toctree-l2"><a class="reference internal" href="loads-stores.html">Load and Store APIs</a></li> <li class="toctree-l2"><a class="reference internal" href="memory.html">The memory API</a></li> <li class="toctree-l2"><a class="reference internal" href="migration.html">Migration</a></li> <li class="toctree-l2"><a class="reference internal" href="atomics.html">Atomic operations in QEMU</a></li> <li class="toctree-l2"><a class="reference internal" href="stable-process.html">QEMU and the stable process</a></li> <li class="toctree-l2"><a class="reference internal" href="ci.html">CI</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">QTest Device Emulation Testing Framework</a><ul> <li class="toctree-l3"><a class="reference internal" href="qgraph.html">Qtest Driver Framework</a></li> <li class="toctree-l3"><a class="reference internal" href="#qtest-protocol">QTest Protocol</a><ul> <li class="toctree-l4"><a class="reference internal" href="#valid-requests">Valid requests</a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="#libqtest-api-reference">libqtest API reference</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="decodetree.html">Decodetree Specification</a></li> <li class="toctree-l2"><a class="reference internal" href="secure-coding-practices.html">Secure Coding Practices</a></li> <li class="toctree-l2"><a class="reference internal" href="tcg.html">Translator Internals</a></li> <li class="toctree-l2"><a class="reference internal" href="tcg-icount.html">TCG Instruction Counting</a></li> <li class="toctree-l2"><a class="reference internal" href="tracing.html">Tracing</a></li> <li class="toctree-l2"><a class="reference internal" href="multi-thread-tcg.html">Multi-threaded TCG</a></li> <li class="toctree-l2"><a class="reference internal" href="tcg-plugins.html">QEMU TCG Plugins</a></li> <li class="toctree-l2"><a class="reference internal" href="bitops.html">Bitwise operations</a></li> <li class="toctree-l2"><a class="reference internal" href="ui.html">QEMU UI subsystem</a></li> <li class="toctree-l2"><a class="reference internal" href="reset.html">Reset in QEMU: the Resettable interface</a></li> <li class="toctree-l2"><a class="reference internal" href="s390-dasd-ipl.html">Booting from real channel-attached devices on s390x</a></li> <li class="toctree-l2"><a class="reference internal" href="clocks.html">Modelling a clock tree in QEMU</a></li> <li class="toctree-l2"><a class="reference internal" href="qom.html">The QEMU Object Model (QOM)</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html">QEMU modules</a></li> <li class="toctree-l2"><a class="reference internal" href="block-coroutine-wrapper.html">block-coroutine-wrapper</a></li> <li class="toctree-l2"><a class="reference internal" href="multi-process.html">Multi-process QEMU</a></li> <li class="toctree-l2"><a class="reference internal" href="ebpf_rss.html">eBPF RSS virtio-net support</a></li> <li class="toctree-l2"><a class="reference internal" href="vfio-migration.html">VFIO device Migration</a></li> <li class="toctree-l2"><a class="reference internal" href="qapi-code-gen.html">How to use the QAPI code generator</a></li> <li class="toctree-l2"><a class="reference internal" href="writing-monitor-commands.html">How to write monitor commands</a></li> <li class="toctree-l2"><a class="reference internal" href="trivial-patches.html">Trivial Patches</a></li> <li class="toctree-l2"><a class="reference internal" href="submitting-a-patch.html">Submitting a Patch</a></li> <li class="toctree-l2"><a class="reference internal" href="submitting-a-pull-request.html">Submitting a Pull Request</a></li> </ul> </li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../index.html">QEMU</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="../index.html">Docs</a> »</li> <li><a href="index.html">Developer Information</a> »</li> <li>QTest Device Emulation Testing Framework</li> <li class="wy-breadcrumbs-aside"> <a href="https://gitlab.com/qemu-project/qemu/blob/master/docs/devel/qtest.rst" class="fa fa-gitlab"> Edit on GitLab</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="qtest-device-emulation-testing-framework"> <h1>QTest Device Emulation Testing Framework<a class="headerlink" href="#qtest-device-emulation-testing-framework" title="Permalink to this headline">¶</a></h1> <div class="toctree-wrapper compound"> </div> <p>QTest is a device emulation testing framework. It can be very useful to test device models; it could also control certain aspects of QEMU (such as virtual clock stepping), with a special purpose “qtest” protocol. Refer to <a class="reference internal" href="#qtest-protocol"><span class="std std-ref">QTest Protocol</span></a> for more details of the protocol.</p> <p>QTest cases can be executed with</p> <div class="code highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">check</span><span class="o">-</span><span class="n">qtest</span> </pre></div> </div> <p>The QTest library is implemented by <code class="docutils literal notranslate"><span class="pre">tests/qtest/libqtest.c</span></code> and the API is defined in <code class="docutils literal notranslate"><span class="pre">tests/qtest/libqtest.h</span></code>.</p> <p>Consider adding a new QTest case when you are introducing a new virtual hardware, or extending one if you are adding functionalities to an existing virtual device.</p> <p>On top of libqtest, a higher level library, <code class="docutils literal notranslate"><span class="pre">libqos</span></code>, was created to encapsulate common tasks of device drivers, such as memory management and communicating with system buses or devices. Many virtual device tests use libqos instead of directly calling into libqtest. Libqos also offers the Qgraph API to increase each test coverage and automate QEMU command line arguments and devices setup. Refer to <a class="reference internal" href="qgraph.html#qgraph"><span class="std std-ref">Qtest Driver Framework</span></a> for Qgraph explanation and API.</p> <p>Steps to add a new QTest case are:</p> <ol class="arabic"> <li><p class="first">Create a new source file for the test. (More than one file can be added as necessary.) For example, <code class="docutils literal notranslate"><span class="pre">tests/qtest/foo-test.c</span></code>.</p> </li> <li><p class="first">Write the test code with the glib and libqtest/libqos API. See also existing tests and the library headers for reference.</p> </li> <li><p class="first">Register the new test in <code class="docutils literal notranslate"><span class="pre">tests/qtest/meson.build</span></code>. Add the test executable name to an appropriate <code class="docutils literal notranslate"><span class="pre">qtests_*</span></code> variable. There is one variable per architecture, plus <code class="docutils literal notranslate"><span class="pre">qtests_generic</span></code> for tests that can be run for all architectures. For example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">qtests_generic</span> <span class="o">=</span> <span class="p">[</span> <span class="o">...</span> <span class="s1">'foo-test'</span><span class="p">,</span> <span class="o">...</span> <span class="p">]</span> </pre></div> </div> </li> <li><p class="first">If the test has more than one source file or needs to be linked with any dependency other than <code class="docutils literal notranslate"><span class="pre">qemuutil</span></code> and <code class="docutils literal notranslate"><span class="pre">qos</span></code>, list them in the <code class="docutils literal notranslate"><span class="pre">qtests</span></code> dictionary. For example a test that needs to use the <code class="docutils literal notranslate"><span class="pre">QIO</span></code> library will have an entry like:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">...</span> <span class="s1">'foo-test'</span><span class="p">:</span> <span class="p">[</span><span class="n">io</span><span class="p">],</span> <span class="o">...</span> <span class="p">}</span> </pre></div> </div> </li> </ol> <p>Debugging a QTest failure is slightly harder than the unit test because the tests look up QEMU program names in the environment variables, such as <code class="docutils literal notranslate"><span class="pre">QTEST_QEMU_BINARY</span></code> and <code class="docutils literal notranslate"><span class="pre">QTEST_QEMU_IMG</span></code>, and also because it is not easy to attach gdb to the QEMU process spawned from the test. But manual invoking and using gdb on the test is still simple to do: find out the actual command from the output of</p> <div class="code highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">check</span><span class="o">-</span><span class="n">qtest</span> <span class="n">V</span><span class="o">=</span><span class="mi">1</span> </pre></div> </div> <p>which you can run manually.</p> <div class="section" id="qtest-protocol"> <span id="id1"></span><h2>QTest Protocol<a class="headerlink" href="#qtest-protocol" title="Permalink to this headline">¶</a></h2> <p>Line based protocol, request/response based. Server can send async messages so clients should always handle many async messages before the response comes in.</p> <div class="section" id="valid-requests"> <h3>Valid requests<a class="headerlink" href="#valid-requests" title="Permalink to this headline">¶</a></h3> <div class="section" id="clock-management"> <h4>Clock management:<a class="headerlink" href="#clock-management" title="Permalink to this headline">¶</a></h4> <p>The qtest client is completely in charge of the QEMU_CLOCK_VIRTUAL. qtest commands let you adjust the value of the clock (monotonically). All the commands return the current value of the clock in nanoseconds.</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> clock_step < OK VALUE </pre></div> </div> <p>Advance the clock to the next deadline. Useful when waiting for asynchronous events.</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> clock_step NS < OK VALUE </pre></div> </div> <p>Advance the clock by NS nanoseconds.</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> clock_set NS < OK VALUE </pre></div> </div> <p>Advance the clock to NS nanoseconds (do nothing if it’s already past).</p> </div> <div class="section" id="pio-and-memory-access"> <h4>PIO and memory access:<a class="headerlink" href="#pio-and-memory-access" title="Permalink to this headline">¶</a></h4> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> outb ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> outw ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> outl ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> inb ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> inw ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> inl ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> writeb ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> writew ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> writel ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> writeq ADDR VALUE < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> readb ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> readw ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> readl ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> readq ADDR < OK VALUE </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> read ADDR SIZE < OK DATA </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> write ADDR SIZE DATA < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> b64read ADDR SIZE < OK B64_DATA </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> b64write ADDR SIZE B64_DATA < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> memset ADDR SIZE VALUE < OK </pre></div> </div> <p>ADDR, SIZE, VALUE are all integers parsed with strtoul() with a base of 0. For ‘memset’ a zero size is permitted and does nothing.</p> <p>DATA is an arbitrarily long hex number prefixed with ‘0x’. If it’s smaller than the expected size, the value will be zero filled at the end of the data sequence.</p> <p>B64_DATA is an arbitrarily long base64 encoded string. If the sizes do not match, the data will be truncated.</p> </div> <div class="section" id="irq-management"> <h4>IRQ management:<a class="headerlink" href="#irq-management" title="Permalink to this headline">¶</a></h4> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> irq_intercept_in QOM-PATH < OK </pre></div> </div> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> irq_intercept_out QOM-PATH < OK </pre></div> </div> <p>Attach to the gpio-in (resp. gpio-out) pins exported by the device at QOM-PATH. When the pin is triggered, one of the following async messages will be printed to the qtest stream:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">IRQ</span> <span class="k">raise</span> <span class="n">NUM</span> <span class="n">IRQ</span> <span class="n">lower</span> <span class="n">NUM</span> </pre></div> </div> <p>where NUM is an IRQ number. For the PC, interrupts can be intercepted simply with “irq_intercept_in ioapic” (note that IRQ0 comes out with NUM=0 even though it is remapped to GSI 2).</p> </div> <div class="section" id="setting-interrupt-level"> <h4>Setting interrupt level:<a class="headerlink" href="#setting-interrupt-level" title="Permalink to this headline">¶</a></h4> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> set_irq_in QOM-PATH NAME NUM LEVEL < OK </pre></div> </div> <p>where NAME is the name of the irq/gpio list, NUM is an IRQ number and LEVEL is an signed integer IRQ level.</p> <p>Forcibly set the given interrupt pin to the given level.</p> </div> </div> </div> <div class="section" id="libqtest-api-reference"> <h2>libqtest API reference<a class="headerlink" href="#libqtest-api-reference" title="Permalink to this headline">¶</a></h2> <dl class="function"> <dt id="c.qtest_initf"> QTestState * <code class="descname">qtest_initf</code><span class="sig-paren">(</span>const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_initf" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>Format for creating other arguments to pass to QEMU, formatted like sprintf().</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Convenience wrapper around qtest_init().</p> <p><strong>Return</strong></p> <p><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance.</p> <dl class="function"> <dt id="c.qtest_vinitf"> QTestState * <code class="descname">qtest_vinitf</code><span class="sig-paren">(</span>const char<em> *fmt</em>, va_list<em> ap</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_vinitf" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>Format for creating other arguments to pass to QEMU, formatted like vsprintf().</dd> <dt><code class="docutils literal notranslate"><span class="pre">va_list</span> <span class="pre">ap</span></code></dt> <dd>Format arguments.</dd> </dl> <p><strong>Description</strong></p> <p>Convenience wrapper around qtest_init().</p> <p><strong>Return</strong></p> <p><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance.</p> <dl class="function"> <dt id="c.qtest_init"> QTestState * <code class="descname">qtest_init</code><span class="sig-paren">(</span>const char<em> *extra_args</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_init" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*extra_args</span></code></dt> <dd>other arguments to pass to QEMU. CAUTION: these arguments are subject to word splitting and shell evaluation.</dd> </dl> <p><strong>Return</strong></p> <p><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance.</p> <dl class="function"> <dt id="c.qtest_init_without_qmp_handshake"> QTestState * <code class="descname">qtest_init_without_qmp_handshake</code><span class="sig-paren">(</span>const char<em> *extra_args</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_init_without_qmp_handshake" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*extra_args</span></code></dt> <dd>other arguments to pass to QEMU. CAUTION: these arguments are subject to word splitting and shell evaluation.</dd> </dl> <p><strong>Return</strong></p> <p><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance.</p> <dl class="function"> <dt id="c.qtest_init_with_serial"> QTestState * <code class="descname">qtest_init_with_serial</code><span class="sig-paren">(</span>const char<em> *extra_args</em>, int<em> *sock_fd</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_init_with_serial" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*extra_args</span></code></dt> <dd>other arguments to pass to QEMU. CAUTION: these arguments are subject to word splitting and shell evaluation.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">*sock_fd</span></code></dt> <dd>pointer to store the socket file descriptor for connection with serial.</dd> </dl> <p><strong>Return</strong></p> <p><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance.</p> <dl class="function"> <dt id="c.qtest_kill_qemu"> void <code class="descname">qtest_kill_qemu</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_kill_qemu" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> </dl> <p><strong>Description</strong></p> <p>Kill the QEMU process and wait for it to terminate. It is safe to call this function multiple times. Normally qtest_quit() is used instead because it also frees QTestState. Use qtest_kill_qemu() when you just want to kill QEMU and qtest_quit() will be called later.</p> <dl class="function"> <dt id="c.qtest_quit"> void <code class="descname">qtest_quit</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_quit" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> </dl> <p><strong>Description</strong></p> <p>Shut down the QEMU process associated to <strong>s</strong>.</p> <dl class="function"> <dt id="c.qtest_qmp_fds"> QDict * <code class="descname">qtest_qmp_fds</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int<em> *fds</em>, size_t<em> fds_num</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_fds" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">*fds</span></code></dt> <dd>array of file descriptors</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">fds_num</span></code></dt> <dd>number of elements in <strong>fds</strong></dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to qemu, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU with fds and returns the response.</p> <dl class="function"> <dt id="c.qtest_qmp"> QDict * <code class="descname">qtest_qmp</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to qemu, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU and returns the response.</p> <dl class="function"> <dt id="c.qtest_qmp_send"> void <code class="descname">qtest_qmp_send</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_send" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to qemu, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU and leaves the response in the stream.</p> <dl class="function"> <dt id="c.qtest_qmp_send_raw"> void <code class="descname">qtest_qmp_send_raw</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_send_raw" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>text to send, formatted like sprintf()</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends text to the QMP monitor verbatim. Need not be valid JSON; this is useful for negative tests.</p> <dl class="function"> <dt id="c.qtest_socket_server"> int <code class="descname">qtest_socket_server</code><span class="sig-paren">(</span>const char<em> *socket_path</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_socket_server" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*socket_path</span></code></dt> <dd>the UNIX domain socket path</dd> </dl> <p><strong>Description</strong></p> <p>Create and return a listen socket file descriptor, or abort on failure.</p> <dl class="function"> <dt id="c.qtest_vqmp_fds"> QDict * <code class="descname">qtest_vqmp_fds</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int<em> *fds</em>, size_t<em> fds_num</em>, const char<em> *fmt</em>, va_list<em> ap</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_vqmp_fds" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">*fds</span></code></dt> <dd>array of file descriptors</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">fds_num</span></code></dt> <dd>number of elements in <strong>fds</strong></dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to QEMU, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">va_list</span> <span class="pre">ap</span></code></dt> <dd>QMP message arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU with fds and returns the response.</p> <dl class="function"> <dt id="c.qtest_vqmp"> QDict * <code class="descname">qtest_vqmp</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, va_list<em> ap</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_vqmp" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to QEMU, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">va_list</span> <span class="pre">ap</span></code></dt> <dd>QMP message arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU and returns the response.</p> <dl class="function"> <dt id="c.qtest_qmp_vsend_fds"> void <code class="descname">qtest_qmp_vsend_fds</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int<em> *fds</em>, size_t<em> fds_num</em>, const char<em> *fmt</em>, va_list<em> ap</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_vsend_fds" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">*fds</span></code></dt> <dd>array of file descriptors</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">fds_num</span></code></dt> <dd>number of elements in <strong>fds</strong></dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to QEMU, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">va_list</span> <span class="pre">ap</span></code></dt> <dd>QMP message arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU and leaves the response in the stream.</p> <dl class="function"> <dt id="c.qtest_qmp_vsend"> void <code class="descname">qtest_qmp_vsend</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, va_list<em> ap</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_vsend" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to QEMU, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">va_list</span> <span class="pre">ap</span></code></dt> <dd>QMP message arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU and leaves the response in the stream.</p> <dl class="function"> <dt id="c.qtest_qmp_receive_dict"> QDict * <code class="descname">qtest_qmp_receive_dict</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_receive_dict" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> </dl> <p><strong>Description</strong></p> <p>Reads a QMP message from QEMU and returns the response.</p> <dl class="function"> <dt id="c.qtest_qmp_receive"> QDict * <code class="descname">qtest_qmp_receive</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_receive" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> </dl> <p><strong>Description</strong></p> <p>Reads a QMP message from QEMU and returns the response. Buffers all the events received meanwhile, until a call to qtest_qmp_eventwait</p> <dl class="function"> <dt id="c.qtest_qmp_eventwait"> void <code class="descname">qtest_qmp_eventwait</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *event</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_eventwait" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*event</span></code></dt> <dd>event to wait for.</dd> </dl> <p><strong>Description</strong></p> <p>Continuously polls for QMP responses until it receives the desired event.</p> <dl class="function"> <dt id="c.qtest_qmp_eventwait_ref"> QDict * <code class="descname">qtest_qmp_eventwait_ref</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *event</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_eventwait_ref" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*event</span></code></dt> <dd>event to wait for.</dd> </dl> <p><strong>Description</strong></p> <p>Continuously polls for QMP responses until it receives the desired event. Returns a copy of the event for further investigation.</p> <dl class="function"> <dt id="c.qtest_qmp_event_ref"> QDict * <code class="descname">qtest_qmp_event_ref</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *event</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_event_ref" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*event</span></code></dt> <dd>event to return.</dd> </dl> <p><strong>Description</strong></p> <p>Removes non-matching events from the buffer that was set by qtest_qmp_receive, until an event bearing the given name is found, and returns it. If no event matches, clears the buffer and returns NULL.</p> <dl class="function"> <dt id="c.qtest_hmp"> char * <code class="descname">qtest_hmp</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_hmp" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>HMP command to send to QEMU, formats arguments like sprintf().</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Send HMP command to QEMU via QMP’s human-monitor-command. QMP events are discarded.</p> <p><strong>Return</strong></p> <p>the command’s output. The caller should g_free() it.</p> <dl class="function"> <dt id="c.qtest_vhmp"> char * <code class="descname">qtest_vhmp</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *fmt</em>, va_list<em> ap</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_vhmp" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>HMP command to send to QEMU, formats arguments like vsprintf().</dd> <dt><code class="docutils literal notranslate"><span class="pre">va_list</span> <span class="pre">ap</span></code></dt> <dd>HMP command arguments</dd> </dl> <p><strong>Description</strong></p> <p>Send HMP command to QEMU via QMP’s human-monitor-command. QMP events are discarded.</p> <p><strong>Return</strong></p> <p>the command’s output. The caller should g_free() it.</p> <dl class="function"> <dt id="c.qtest_get_irq"> bool <code class="descname">qtest_get_irq</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int<em> num</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_get_irq" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">num</span></code></dt> <dd>Interrupt to observe.</dd> </dl> <p><strong>Return</strong></p> <p>The level of the <strong>num</strong> interrupt.</p> <dl class="function"> <dt id="c.qtest_irq_intercept_in"> void <code class="descname">qtest_irq_intercept_in</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *string</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_irq_intercept_in" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*string</span></code></dt> <dd>QOM path of a device.</dd> </dl> <p><strong>Description</strong></p> <p>Associate qtest irqs with the GPIO-in pins of the device whose path is specified by <strong>string</strong>.</p> <dl class="function"> <dt id="c.qtest_irq_intercept_out"> void <code class="descname">qtest_irq_intercept_out</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *string</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_irq_intercept_out" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*string</span></code></dt> <dd>QOM path of a device.</dd> </dl> <p><strong>Description</strong></p> <p>Associate qtest irqs with the GPIO-out pins of the device whose path is specified by <strong>string</strong>.</p> <dl class="function"> <dt id="c.qtest_set_irq_in"> void <code class="descname">qtest_set_irq_in</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *string</em>, const char<em> *name</em>, int<em> irq</em>, int<em> level</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_set_irq_in" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd>QTestState instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*string</span></code></dt> <dd>QOM path of a device</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*name</span></code></dt> <dd>IRQ name</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">irq</span></code></dt> <dd>IRQ number</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">level</span></code></dt> <dd>IRQ level</dd> </dl> <p><strong>Description</strong></p> <p>Force given device/irq GPIO-in pin to the given level.</p> <dl class="function"> <dt id="c.qtest_outb"> void <code class="descname">qtest_outb</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint16_t<em> addr</em>, uint8_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_outb" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">addr</span></code></dt> <dd>I/O port to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint8_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Write an 8-bit value to an I/O port.</p> <dl class="function"> <dt id="c.qtest_outw"> void <code class="descname">qtest_outw</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint16_t<em> addr</em>, uint16_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_outw" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">addr</span></code></dt> <dd>I/O port to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Write a 16-bit value to an I/O port.</p> <dl class="function"> <dt id="c.qtest_outl"> void <code class="descname">qtest_outl</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint16_t<em> addr</em>, uint32_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_outl" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">addr</span></code></dt> <dd>I/O port to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint32_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Write a 32-bit value to an I/O port.</p> <dl class="function"> <dt id="c.qtest_inb"> uint8_t <code class="descname">qtest_inb</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint16_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_inb" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">addr</span></code></dt> <dd>I/O port to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Returns an 8-bit value from an I/O port.</p> <dl class="function"> <dt id="c.qtest_inw"> uint16_t <code class="descname">qtest_inw</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint16_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_inw" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">addr</span></code></dt> <dd>I/O port to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Returns a 16-bit value from an I/O port.</p> <dl class="function"> <dt id="c.qtest_inl"> uint32_t <code class="descname">qtest_inl</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint16_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_inl" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">addr</span></code></dt> <dd>I/O port to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Returns a 32-bit value from an I/O port.</p> <dl class="function"> <dt id="c.qtest_writeb"> void <code class="descname">qtest_writeb</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, uint8_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_writeb" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint8_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Writes an 8-bit value to memory.</p> <dl class="function"> <dt id="c.qtest_writew"> void <code class="descname">qtest_writew</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, uint16_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_writew" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint16_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Writes a 16-bit value to memory.</p> <dl class="function"> <dt id="c.qtest_writel"> void <code class="descname">qtest_writel</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, uint32_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_writel" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint32_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Writes a 32-bit value to memory.</p> <dl class="function"> <dt id="c.qtest_writeq"> void <code class="descname">qtest_writeq</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, uint64_t<em> value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_writeq" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">value</span></code></dt> <dd>Value being written.</dd> </dl> <p><strong>Description</strong></p> <p>Writes a 64-bit value to memory.</p> <dl class="function"> <dt id="c.qtest_readb"> uint8_t <code class="descname">qtest_readb</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_readb" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Reads an 8-bit value from memory.</p> <p><strong>Return</strong></p> <p>Value read.</p> <dl class="function"> <dt id="c.qtest_readw"> uint16_t <code class="descname">qtest_readw</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_readw" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Reads a 16-bit value from memory.</p> <p><strong>Return</strong></p> <p>Value read.</p> <dl class="function"> <dt id="c.qtest_readl"> uint32_t <code class="descname">qtest_readl</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_readl" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Reads a 32-bit value from memory.</p> <p><strong>Return</strong></p> <p>Value read.</p> <dl class="function"> <dt id="c.qtest_readq"> uint64_t <code class="descname">qtest_readq</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_readq" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to read from.</dd> </dl> <p><strong>Description</strong></p> <p>Reads a 64-bit value from memory.</p> <p><strong>Return</strong></p> <p>Value read.</p> <dl class="function"> <dt id="c.qtest_memread"> void <code class="descname">qtest_memread</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, void<em> *data</em>, size_t<em> size</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_memread" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to read from.</dd> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Pointer to where memory contents will be stored.</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">size</span></code></dt> <dd>Number of bytes to read.</dd> </dl> <p><strong>Description</strong></p> <p>Read guest memory into a buffer.</p> <dl class="function"> <dt id="c.qtest_rtas_call"> uint64_t <code class="descname">qtest_rtas_call</code><span class="sig-paren">(</span>QTestState<em> *s</em>, const char<em> *name</em>, uint32_t<em> nargs</em>, uint64_t<em> args</em>, uint32_t<em> nret</em>, uint64_t<em> ret</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_rtas_call" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*name</span></code></dt> <dd>name of the command to call.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint32_t</span> <span class="pre">nargs</span></code></dt> <dd>Number of args.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">args</span></code></dt> <dd>Guest address to read args from.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint32_t</span> <span class="pre">nret</span></code></dt> <dd>Number of return value.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">ret</span></code></dt> <dd>Guest address to write return values to.</dd> </dl> <p><strong>Description</strong></p> <p>Call an RTAS function</p> <dl class="function"> <dt id="c.qtest_bufread"> void <code class="descname">qtest_bufread</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, void<em> *data</em>, size_t<em> size</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_bufread" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to read from.</dd> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Pointer to where memory contents will be stored.</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">size</span></code></dt> <dd>Number of bytes to read.</dd> </dl> <p><strong>Description</strong></p> <p>Read guest memory into a buffer and receive using a base64 encoding.</p> <dl class="function"> <dt id="c.qtest_memwrite"> void <code class="descname">qtest_memwrite</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, const void<em> *data</em>, size_t<em> size</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_memwrite" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Pointer to the bytes that will be written to guest memory.</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">size</span></code></dt> <dd>Number of bytes to write.</dd> </dl> <p><strong>Description</strong></p> <p>Write a buffer to guest memory.</p> <dl class="function"> <dt id="c.qtest_bufwrite"> void <code class="descname">qtest_bufwrite</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, const void<em> *data</em>, size_t<em> size</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_bufwrite" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Pointer to the bytes that will be written to guest memory.</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">size</span></code></dt> <dd>Number of bytes to write.</dd> </dl> <p><strong>Description</strong></p> <p>Write a buffer to guest memory and transmit using a base64 encoding.</p> <dl class="function"> <dt id="c.qtest_memset"> void <code class="descname">qtest_memset</code><span class="sig-paren">(</span>QTestState<em> *s</em>, uint64_t<em> addr</em>, uint8_t<em> patt</em>, size_t<em> size</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_memset" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint64_t</span> <span class="pre">addr</span></code></dt> <dd>Guest address to write to.</dd> <dt><code class="docutils literal notranslate"><span class="pre">uint8_t</span> <span class="pre">patt</span></code></dt> <dd>Byte pattern to fill the guest memory region with.</dd> <dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">size</span></code></dt> <dd>Number of bytes to write.</dd> </dl> <p><strong>Description</strong></p> <p>Write a pattern to guest memory.</p> <dl class="function"> <dt id="c.qtest_clock_step_next"> int64_t <code class="descname">qtest_clock_step_next</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_clock_step_next" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd><code class="xref c c-type docutils literal notranslate"><span class="pre">QTestState</span></code> instance to operate on.</dd> </dl> <p><strong>Description</strong></p> <p>Advance the QEMU_CLOCK_VIRTUAL to the next deadline.</p> <p><strong>Return</strong></p> <p>The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.</p> <dl class="function"> <dt id="c.qtest_clock_step"> int64_t <code class="descname">qtest_clock_step</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int64_t<em> step</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_clock_step" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd>QTestState instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int64_t</span> <span class="pre">step</span></code></dt> <dd>Number of nanoseconds to advance the clock by.</dd> </dl> <p><strong>Description</strong></p> <p>Advance the QEMU_CLOCK_VIRTUAL by <strong>step</strong> nanoseconds.</p> <p><strong>Return</strong></p> <p>The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.</p> <dl class="function"> <dt id="c.qtest_clock_set"> int64_t <code class="descname">qtest_clock_set</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int64_t<em> val</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_clock_set" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd>QTestState instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int64_t</span> <span class="pre">val</span></code></dt> <dd>Nanoseconds value to advance the clock to.</dd> </dl> <p><strong>Description</strong></p> <p>Advance the QEMU_CLOCK_VIRTUAL to <strong>val</strong> nanoseconds since the VM was launched.</p> <p><strong>Return</strong></p> <p>The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds.</p> <dl class="function"> <dt id="c.qtest_big_endian"> bool <code class="descname">qtest_big_endian</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_big_endian" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd>QTestState instance to operate on.</dd> </dl> <p><strong>Return</strong></p> <p>True if the architecture under test has a big endian configuration.</p> <dl class="function"> <dt id="c.qtest_get_arch"> const char * <code class="descname">qtest_get_arch</code><span class="sig-paren">(</span>void<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_get_arch" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">void</span></code></dt> <dd>no arguments</dd> </dl> <p><strong>Return</strong></p> <p>The architecture for the QEMU executable under test.</p> <dl class="function"> <dt id="c.qtest_has_accel"> bool <code class="descname">qtest_has_accel</code><span class="sig-paren">(</span>const char<em> *accel_name</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_has_accel" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*accel_name</span></code></dt> <dd>Accelerator name to check for.</dd> </dl> <p><strong>Return</strong></p> <p>true if the accelerator is built in.</p> <dl class="function"> <dt id="c.qtest_add_func"> void <code class="descname">qtest_add_func</code><span class="sig-paren">(</span>const char<em> *str</em>, void (<em>*fn</em>)(void)<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_add_func" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*str</span></code></dt> <dd>Test case path.</dd> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">(*fn)(void)</span></code></dt> <dd>Test case function</dd> </dl> <p><strong>Description</strong></p> <p>Add a GTester testcase with the given name and function. The path is prefixed with the architecture under test, as returned by qtest_get_arch().</p> <dl class="function"> <dt id="c.qtest_add_data_func"> void <code class="descname">qtest_add_data_func</code><span class="sig-paren">(</span>const char<em> *str</em>, const void<em> *data</em>, void (<em>*fn</em>)(const void *)<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_add_data_func" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*str</span></code></dt> <dd>Test case path.</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Test case data</dd> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">(*fn)(const</span> <span class="pre">void</span> <span class="pre">*)</span></code></dt> <dd>Test case function</dd> </dl> <p><strong>Description</strong></p> <p>Add a GTester testcase with the given name, data and function. The path is prefixed with the architecture under test, as returned by qtest_get_arch().</p> <dl class="function"> <dt id="c.qtest_add_data_func_full"> void <code class="descname">qtest_add_data_func_full</code><span class="sig-paren">(</span>const char<em> *str</em>, void<em> *data</em>, void (<em>*fn</em>)(const void *), GDestroyNotify<em> data_free_func</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_add_data_func_full" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*str</span></code></dt> <dd>Test case path.</dd> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Test case data</dd> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">(*fn)(const</span> <span class="pre">void</span> <span class="pre">*)</span></code></dt> <dd>Test case function</dd> <dt><code class="docutils literal notranslate"><span class="pre">GDestroyNotify</span> <span class="pre">data_free_func</span></code></dt> <dd>GDestroyNotify for data</dd> </dl> <p><strong>Description</strong></p> <p>Add a GTester testcase with the given name, data and function. The path is prefixed with the architecture under test, as returned by qtest_get_arch().</p> <p><strong>data</strong> is passed to <strong>data_free_func()</strong> on test completion.</p> <dl class="function"> <dt id="c.qtest_add"> <code class="descname">qtest_add</code><span class="sig-paren">(</span>testpath, Fixture, tdata, fsetup, ftest, fteardown<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_add" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">testpath</span></code></dt> <dd>Test case path</dd> <dt><code class="docutils literal notranslate"><span class="pre">Fixture</span></code></dt> <dd>Fixture type</dd> <dt><code class="docutils literal notranslate"><span class="pre">tdata</span></code></dt> <dd>Test case data</dd> <dt><code class="docutils literal notranslate"><span class="pre">fsetup</span></code></dt> <dd>Test case setup function</dd> <dt><code class="docutils literal notranslate"><span class="pre">ftest</span></code></dt> <dd>Test case function</dd> <dt><code class="docutils literal notranslate"><span class="pre">fteardown</span></code></dt> <dd>Test case teardown function</dd> </dl> <p><strong>Description</strong></p> <p>Add a GTester testcase with the given name, data and functions. The path is prefixed with the architecture under test, as returned by qtest_get_arch().</p> <dl class="function"> <dt id="c.qtest_add_abrt_handler"> void <code class="descname">qtest_add_abrt_handler</code><span class="sig-paren">(</span>GHookFunc<em> fn</em>, const void<em> *data</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_add_abrt_handler" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">GHookFunc</span> <span class="pre">fn</span></code></dt> <dd>Handler function</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Argument that is passed to the handler</dd> </dl> <p><strong>Description</strong></p> <p>Add a handler function that is invoked on SIGABRT. This can be used to terminate processes and perform other cleanup. The handler can be removed with qtest_remove_abrt_handler().</p> <dl class="function"> <dt id="c.qtest_remove_abrt_handler"> void <code class="descname">qtest_remove_abrt_handler</code><span class="sig-paren">(</span>void<em> *data</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_remove_abrt_handler" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">*data</span></code></dt> <dd>Argument previously passed to qtest_add_abrt_handler()</dd> </dl> <p><strong>Description</strong></p> <p>Remove an abrt handler that was previously added with qtest_add_abrt_handler().</p> <dl class="function"> <dt id="c.qtest_qmp_assert_success"> void <code class="descname">qtest_qmp_assert_success</code><span class="sig-paren">(</span>QTestState<em> *qts</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_assert_success" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*qts</span></code></dt> <dd>QTestState instance to operate on</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to qemu, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Sends a QMP message to QEMU and asserts that a ‘return’ key is present in the response.</p> <dl class="function"> <dt id="c.qtest_cb_for_every_machine"> void <code class="descname">qtest_cb_for_every_machine</code><span class="sig-paren">(</span>void (<em>*cb</em>)(const char *machine), bool<em> skip_old_versioned</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_cb_for_every_machine" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">void</span> <span class="pre">(*cb)(const</span> <span class="pre">char</span> <span class="pre">*machine)</span></code></dt> <dd>Pointer to the callback function</dd> <dt><code class="docutils literal notranslate"><span class="pre">bool</span> <span class="pre">skip_old_versioned</span></code></dt> <dd><p class="first">true if versioned old machine types should be skipped</p> <p class="last">Call a callback function for every name of all available machines.</p> </dd> </dl> <dl class="function"> <dt id="c.qtest_qmp_device_add_qdict"> void <code class="descname">qtest_qmp_device_add_qdict</code><span class="sig-paren">(</span>QTestState<em> *qts</em>, const char<em> *drv</em>, const QDict<em> *arguments</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_device_add_qdict" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*qts</span></code></dt> <dd>QTestState instance to operate on</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*drv</span></code></dt> <dd>Name of the device that should be added</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">QDict</span> <span class="pre">*arguments</span></code></dt> <dd>QDict with properties for the device to intialize</dd> </dl> <p><strong>Description</strong></p> <p>Generic hot-plugging test via the device_add QMP command with properties supplied in form of QDict. Use NULL for empty properties list.</p> <dl class="function"> <dt id="c.qtest_qmp_device_add"> void <code class="descname">qtest_qmp_device_add</code><span class="sig-paren">(</span>QTestState<em> *qts</em>, const char<em> *driver</em>, const char<em> *id</em>, const char<em> *fmt</em>, ...<span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_device_add" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*qts</span></code></dt> <dd>QTestState instance to operate on</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*driver</span></code></dt> <dd>Name of the device that should be added</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*id</span></code></dt> <dd>Identification string</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*fmt</span></code></dt> <dd>QMP message to send to qemu, formatted like qobject_from_jsonf_nofail(). See parse_interpolation() for what’s supported after ‘%’.</dd> <dt><code class="docutils literal notranslate"><span class="pre">...</span></code></dt> <dd>variable arguments</dd> </dl> <p><strong>Description</strong></p> <p>Generic hot-plugging test via the device_add QMP command.</p> <dl class="function"> <dt id="c.qtest_qmp_device_del"> void <code class="descname">qtest_qmp_device_del</code><span class="sig-paren">(</span>QTestState<em> *qts</em>, const char<em> *id</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_qmp_device_del" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*qts</span></code></dt> <dd>QTestState instance to operate on</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*id</span></code></dt> <dd>Identification string</dd> </dl> <p><strong>Description</strong></p> <p>Generic hot-unplugging test via the device_del QMP command.</p> <dl class="function"> <dt id="c.qmp_rsp_is_err"> bool <code class="descname">qmp_rsp_is_err</code><span class="sig-paren">(</span>QDict<em> *rsp</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qmp_rsp_is_err" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QDict</span> <span class="pre">*rsp</span></code></dt> <dd>QMP response to check for error</dd> </dl> <p><strong>Description</strong></p> <p>Test <strong>rsp</strong> for error and discard <strong>rsp</strong>. Returns ‘true’ if there is error in <strong>rsp</strong> and ‘false’ otherwise.</p> <dl class="function"> <dt id="c.qmp_expect_error_and_unref"> void <code class="descname">qmp_expect_error_and_unref</code><span class="sig-paren">(</span>QDict<em> *rsp</em>, const char<em> *class</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qmp_expect_error_and_unref" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QDict</span> <span class="pre">*rsp</span></code></dt> <dd>QMP response to check for error</dd> <dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*class</span></code></dt> <dd>an error class</dd> </dl> <p><strong>Description</strong></p> <p>Assert the response has the given error class and discard <strong>rsp</strong>.</p> <dl class="function"> <dt id="c.qtest_probe_child"> bool <code class="descname">qtest_probe_child</code><span class="sig-paren">(</span>QTestState<em> *s</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_probe_child" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd>QTestState instance to operate on.</dd> </dl> <p><strong>Return</strong></p> <p>true if the child is still alive.</p> <dl class="function"> <dt id="c.qtest_set_expected_status"> void <code class="descname">qtest_set_expected_status</code><span class="sig-paren">(</span>QTestState<em> *s</em>, int<em> status</em><span class="sig-paren">)</span><a class="headerlink" href="#c.qtest_set_expected_status" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p><strong>Parameters</strong></p> <dl class="docutils"> <dt><code class="docutils literal notranslate"><span class="pre">QTestState</span> <span class="pre">*s</span></code></dt> <dd>QTestState instance to operate on.</dd> <dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">status</span></code></dt> <dd>an expected exit status.</dd> </dl> <p><strong>Description</strong></p> <p>Set expected exit status of the child.</p> </div> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="qgraph.html" class="btn btn-neutral float-right" title="Qtest Driver Framework" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="ci.html" class="btn btn-neutral" title="CI" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2021, The QEMU Project Developers. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. <!-- Empty para to force a blank line after "Built with Sphinx ..." --> <p></p> <p>This documentation is for QEMU version 6.2.0.</p> <p><a href="../about/license.html">QEMU and this manual are released under the GNU General Public License, version 2.</a></p> </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'../', VERSION:'qemu-kvm-6.2.0-53.module+el8.10.0+2055+8eb7870b.4', LANGUAGE:'None', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: false, SOURCELINK_SUFFIX: '.txt' }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>