qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

fuzz-e1000e-test.c (1364B)


      1 /*
      2  * QTest testcase for e1000e device generated by fuzzer
      3  *
      4  * Copyright (c) 2021 Red Hat, Inc.
      5  *
      6  * SPDX-License-Identifier: GPL-2.0-or-later
      7  */
      8 
      9 #include "qemu/osdep.h"
     10 
     11 #include "libqtest.h"
     12 
     13 /*
     14  * https://bugs.launchpad.net/qemu/+bug/1879531
     15  */
     16 static void test_lp1879531_eth_get_rss_ex_dst_addr(void)
     17 {
     18     QTestState *s;
     19 
     20     s = qtest_init("-nographic -monitor none -serial none -M pc-q35-5.0");
     21 
     22     qtest_outl(s, 0xcf8, 0x80001010);
     23     qtest_outl(s, 0xcfc, 0xe1020000);
     24     qtest_outl(s, 0xcf8, 0x80001004);
     25     qtest_outw(s, 0xcfc, 0x7);
     26     qtest_writeb(s, 0x25, 0x86);
     27     qtest_writeb(s, 0x26, 0xdd);
     28     qtest_writeb(s, 0x4f, 0x2b);
     29 
     30     qtest_writel(s, 0xe1020030, 0x190002e1);
     31     qtest_writew(s, 0xe102003a, 0x0807);
     32     qtest_writel(s, 0xe1020048, 0x12077cdd);
     33     qtest_writel(s, 0xe1020400, 0xba077cdd);
     34     qtest_writel(s, 0xe1020420, 0x190002e1);
     35     qtest_writel(s, 0xe1020428, 0x3509d807);
     36     qtest_writeb(s, 0xe1020438, 0xe2);
     37     qtest_writeb(s, 0x4f, 0x2b);
     38     qtest_quit(s);
     39 }
     40 
     41 int main(int argc, char **argv)
     42 {
     43     const char *arch = qtest_get_arch();
     44 
     45     g_test_init(&argc, &argv, NULL);
     46 
     47     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
     48         qtest_add_func("fuzz/test_lp1879531_eth_get_rss_ex_dst_addr",
     49                        test_lp1879531_eth_get_rss_ex_dst_addr);
     50     }
     51 
     52     return g_test_run();
     53 }