Andreas Färber | fbaf445 | 2014-03-30 19:22:48 +0200 | [diff] [blame] | 1 | /* |
| 2 | * QTest testcase for Intel HDA |
| 3 | * |
| 4 | * Copyright (c) 2014 SUSE LINUX Products GmbH |
| 5 | * |
| 6 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 7 | * See the COPYING file in the top-level directory. |
| 8 | */ |
| 9 | |
| 10 | #include <glib.h> |
| 11 | #include <string.h> |
| 12 | #include "libqtest.h" |
| 13 | #include "qemu/osdep.h" |
| 14 | |
| 15 | #define HDA_ID "hda0" |
| 16 | #define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \ |
| 17 | " -device hda-micro,bus=" HDA_ID ".0" \ |
| 18 | " -device hda-duplex,bus=" HDA_ID ".0" |
| 19 | |
| 20 | /* Tests only initialization so far. TODO: Replace with functional tests */ |
| 21 | static void ich6_test(void) |
| 22 | { |
| 23 | qtest_start("-device intel-hda,id=" HDA_ID CODEC_DEVICES); |
| 24 | qtest_end(); |
| 25 | } |
| 26 | |
| 27 | static void ich9_test(void) |
| 28 | { |
| 29 | qtest_start("-machine q35 -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id=" |
| 30 | HDA_ID CODEC_DEVICES); |
| 31 | qtest_end(); |
| 32 | } |
| 33 | |
| 34 | int main(int argc, char **argv) |
| 35 | { |
| 36 | int ret; |
| 37 | |
| 38 | g_test_init(&argc, &argv, NULL); |
| 39 | qtest_add_func("/intel-hda/ich6", ich6_test); |
| 40 | qtest_add_func("/intel-hda/ich9", ich9_test); |
| 41 | |
| 42 | ret = g_test_run(); |
| 43 | |
| 44 | return ret; |
| 45 | } |