summaryrefslogtreecommitdiff
path: root/tests/ahci-test.c
AgeCommit message (Collapse)Author
2018-02-14libqos: Use explicit QTestState for remaining libqos operationsEric Blake
Drop one more client of global_qtest by teaching all remaining libqos stragglers to pass in an explicit QTestState. Change the setting of global_qtest from being implicit in libqos' call to qtest_start() to instead be explicit in all clients that are still relying on global_qtest. Note that qmp_execute() can be greatly simplified in the process, and that we also get rid of interpolation of a JSON string into a temporary variable when qtest_qmp() can do it more reliably. Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: Greg Kurz <groug@kaod.org> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-14libqos: Track QTestState with QPCIBusEric Blake
When initializing a QPCIBus, track which QTestState the bus is associated with (so that a later patch can then explicitly use that test state for all communication on the bus, rather than blindly relying on global_qtest). Update the initialization functions to take another parameter, and update all callers to pass in state (for now, most callers get away with passing the current global_qtest as the current state, although this required fixing the order of initialization to ensure qtest_start() is called before qpci_init*() in rtl8139-test, and provided an opportunity to pass in the allocator in e1000e-test). Touch up some allocations to use g_new0() rather than g_malloc() while in the area, and simplify some code (all implementations of QOSOps provide a .init_allocator() that never fails). Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> [thuth: Removed hunk from vhost-user-test.c that is not required anymore, fixed conflict in qtest_vboot() and adjusted qpci_init_pc() in sdhci-test] Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-09Include qapi/qmp/qdict.h exactly where neededMarkus Armbruster
This cleanup makes the number of objects depending on qapi/qmp/qdict.h drop from 4550 (out of 4743) to 368 in my "build everything" tree. For qapi/qmp/qobject.h, the number drops from 4552 to 390. While there, separate #include from file comment with a blank line. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-13-armbru@redhat.com>
2018-01-23blockdev: Mark BD-{remove,insert}-medium stableMax Reitz
Now that iotest 093 test proves that the throttling configuration survives a blockdev-remove-medium/blockdev-insert-medium pair, the original reason for declaring these commands experimental is gone (see commit 6e0abc251dd4f8eba1f53656dfede12e5840e83b). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20171110224302.14424-5-mreitz@redhat.com Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2018-01-23tests/ahci: Switch tray and medium commands to @idMax Reitz
Currently, the tray and medium commands in the AHCI test use the deprecated @device parameter. This patch switches all invocations over to use @id. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20171110224302.14424-3-mreitz@redhat.com Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-10-16tests: use g_new() family of functionsMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [PMD: split of some files in other commits of the same series, add libqtest.c] Acked-by: John Snow <jsnow@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2017-07-18tests/ahci-test: Be mean with RAMDr. David Alan Gilbert
The migration tests used two VMs each with -m 1024 this caused problems when run in some small, pessimistic test VMs (netbsd). We can just be meaner with the amount of RAM in the test and use -m 384 Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 20170714152820.24034-1-dgilbert@redhat.com Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
2016-11-14ahci-test: add QMP tray test for ATAPIJohn Snow
Test QMP events for a CDROM device with or without a media inserted, including both guest-initiated and hw-initiated eject/load requests. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1478553214-497-7-git-send-email-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2016-11-14ahci-test: test atapi read_cd with bcl, nb_sectors = 0John Snow
Commit 9ef2e93f introduced the concept of tagging ATAPI commands as NONDATA, but this introduced a regression for certain commands better described as CONDDATA. read_cd is such a command that both requires a non-zero BCL if a transfer size is set, but is perfectly content to accept a zero BCL if the transfer size is 0. This test adds a regression test for the case where BCL and nb_sectors are both 0. Flesh out the CDROM tests by: (1) Allowing the test to specify a BCL (2) Allowing the buffer comparison test to compare a 0-size buffer (3) Fix the BCL specification in libqos (It is LE, not BE) (4) Add a nice human-readable message for future SCSI command additions Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1477970211-25754-4-git-send-email-jsnow@redhat.com [Line length edit --js] Signed-off-by: John Snow <jsnow@redhat.com>
2016-11-14ahci-test: Create smaller test ISO imagesJohn Snow
These can simply be the size of the number of sectors we're reading, plus one for a buffer. We don't need them to be any larger. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1477970211-25754-3-git-send-email-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2016-10-28tests: Don't assume structure of PCI IO base in ahci-testDavid Gibson
In a couple of places ahci-test makes assumptions about how the tokens returned from qpci_iomap() are formatted in ways it probably shouldn't. First in verify_state() it uses a non-NULL token to indicate that the AHCI device has been enabled (part of enabling is to iomap()). This changes it to use an explicit 'enabled' flag instead. Second, it uses the fact that the token contains a PCI address, stored when the BAR is mapped during initialization to check that the BAR has the same value after a migration. This changes it to explicitly read the BAR register before and after the migration and compare. Together, these changes will make the test more robust against changes to the internals of the libqos PCI layer. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org>
2016-07-18tests: in IDE and AHCI tests perform DMA write before flushingEvgeny Yakovlev
Due to changes in flush behaviour clean disks stopped generating flush_to_disk events and IDE and AHCI tests that test flush commands started to fail. This change adds additional DMA writes to affected tests before sending flush commands so that bdrv_flush actually generates flush_to_disk event. Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1468870792-7411-4-git-send-email-den@openvz.org CC: Kevin Wolf <kwolf@redhat.com> CC: Max Reitz <mreitz@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Fam Zheng <famz@redhat.com> CC: John Snow <jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
2016-06-07tests: Remove unnecessary glib.h includesPeter Maydell
Remove glib.h includes, as it is provided by osdep.h. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-29ide: Clean up includesPeter Maydell
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453832250-766-17-git-send-email-peter.maydell@linaro.org
2016-01-11qtest/ahci: ATAPI data testsJohn Snow
Simple I/O tests for DMA and PIO pathways in the AHCI HBA. I believe at this point in time all of the common, major IO pathways in BMDMA and AHCI are covered by qtests now. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1452282920-21550-9-git-send-email-jsnow@redhat.com
2016-01-11libqos/ahci: allow nondata commands for ahci_io variantsJohn Snow
These variants try to set a data offset, even if you don't specify one. In the cases where the offset is zero and it's a nondata command, just ignore the instruction. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1452282920-21550-7-git-send-email-jsnow@redhat.com
2016-01-11libqos: allow zero-size allocationsJohn Snow
As part of streamlining the AHCI tests interface, it'd be nice if specying a size of zero could be handled without special branches and the allocator could handle this special case gracefully. This lets me use the "ahci_io" macros for non-data commands, too, which moves me forward towards shepherding all AHCI qtests into a common set of commands in a unified pipeline. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1452282920-21550-6-git-send-email-jsnow@redhat.com
2016-01-11libqos/ahci: ATAPI identifyJohn Snow
We need to say "hello!" to our ATAPI friends in a slightly different manner. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1452282920-21550-4-git-send-email-jsnow@redhat.com
2016-01-11ahci-test: fix memory leakJohn Snow
Use the proper free command to detroy an AHCICommand. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1452282920-21550-2-git-send-email-jsnow@redhat.com
2015-11-13qtest/ahci: use raw format when qemu-img is absentJohn Snow
If we don't have the qemu-img tool, use the raw format for tests and skip the high-sector LBA48 tests. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1447439479-16775-4-git-send-email-jsnow@redhat.com
2015-11-13qtest/ahci: always specify image formatJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1447439479-16775-2-git-send-email-jsnow@redhat.com
2015-11-13ahci/qtest: don't use tcp sockets for migration testsJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1447108074-20609-1-git-send-email-jsnow@redhat.com
2015-09-18qtest/ahci: export generate_patternJohn Snow
Share the pattern function for ide and ahci test. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1441926555-19471-3-git-send-email-jsnow@redhat.com
2015-09-18qtest/ahci: use generate_pattern everywhereJohn Snow
Fix the pattern generation to actually be interesting, and make sure all buffers in the ahci-test actually use it. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1441926555-19471-2-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: halted ncq migration testJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435767578-32743-15-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: halted NCQ testJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435767578-32743-10-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: ncq migration testJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-17-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: simple ncq data testJohn Snow
Test the NCQ pathways for a simple IO RW test. Also, test that libqos doesn't explode when running NCQ commands :) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-16-git-send-email-jsnow@redhat.com
2015-07-04ahci/qtest: Execute IDENTIFY prior to data commandsJohn Snow
If you try to execute an NCQ command before trying to engage with the device by issuing an IDENTIFY command, the error bits that are part of the signature will fool the test suite into thinking there was a failure. Issue IDENTIFY first on "boot", which will clear the signature out of the registers for us. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-9-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: add port_reset testJohn Snow
Test that we can survive a couple of cycles of running a basic identify test, some IO, and resetting the HBA. Ensures that we can bring the HBA back to compliant spec during the lifecycle of the VM. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1434470575-21625-5-git-send-email-jsnow@redhat.com
2015-07-04qtest/ahci: add test_maxJohn Snow
Test that the FIS delivered after a nondata command has appropriately updated registers, just as we'd expect a data command to do. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1434470575-21625-3-git-send-email-jsnow@redhat.com
2015-06-19tests: Use qtest_add_data_func() consistentlyAndreas Färber
Replace uses of g_test_add_data_func() for QTest test cases. It is still valid to use it for any non-QTest test cases, which are not run for multiple target binaries. Suggested-by: John Snow <jsnow@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-05-22libqos/ahci: Swap memread/write with bufread/writeJohn Snow
Where it makes sense, use the new faster primitives. For generally small reads/writes such as for the PRDT and FIS packets, stick with the more wasteful but easier to debug memread/memwrite. For ahci-test (before migration tests): With this patch: real 0m3.675s user 0m2.582s sys 0m1.718s Without any qtest protocol improvements: real 0m14.171s user 0m12.072s sys 0m12.527s Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1430864578-22072-6-git-send-email-jsnow@redhat.com
2015-05-22qtest/ahci: add migrate halted dma testJohn Snow
Test migrating a halted DMA transaction. Resume, then test data integrity. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-10-git-send-email-jsnow@redhat.com
2015-05-22qtest/ahci: add halted dma testJohn Snow
If we're going to test the migration of halted DMA jobs, we should probably check to make sure we can resume them locally as a first step. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-9-git-send-email-jsnow@redhat.com
2015-05-22qtest/ahci: add flush migrate testJohn Snow
Use blkdebug to inject an error on first flush, then attempt to flush on the first guest. When the error halts the VM, migrate to the second VM, and attempt to resume the command. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-8-git-send-email-jsnow@redhat.com
2015-05-22qtest/ahci: add migrate dma testJohn Snow
Write to one guest, migrate, and then read from the other. adjust ahci_io to clear any buffers it creates, so that we can use ahci_io safely on both guests knowing we are using empty buffers and not accidentally re-using data. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-7-git-send-email-jsnow@redhat.com
2015-05-22qtest/ahci: Add migration testJohn Snow
Notes: * The migration is performed on QOSState objects. * The migration is performed in such a way that it does not assume consistency between the allocators attached to each. That is to say, you can use each QOSState object completely independently and then at an arbitrary point decide to migrate, and the destination object will now be consistent with the memory within the source guest. The source object that was migrated from will have a completely blank allocator. ahci-test.c: - verify_state is added - ahci_migrate is added as a frontend to migrate - test_migrate_sanity test case is added. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1430417242-11859-6-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: add flush retry testJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-7-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: Allow override of default CLI optionsJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-3-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: Add simple flush testJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-2-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: test different disk sectorsJohn Snow
Test sector offset 0, 1, and the last sector(s) in LBA28 and LBA48 modes. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1426274523-22661-3-git-send-email-jsnow@redhat.com
2015-04-28qtest/ahci: add qcow2 support to ahci-testJohn Snow
This will enable the testing of high offsets without wasting a lot of disk space, and does not impact the previous tests. mkimg and mkqcow2 are added to libqos for other tests. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1426274523-22661-2-git-send-email-jsnow@redhat.com
2015-03-23ahci-test: improve rw buffer patternsJohn Snow
My pattern was cyclical every 256 bytes, so it missed a fairly obvious failure case. Add some rand() pepper into the test pattern, and for large patterns that exceed 256 sectors, start writing an ID per-sector so that we never generate identical sector patterns. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Tested-by: Andreas Färber <afaerber@suse.de> Message-id: 1426811056-2202-5-git-send-email-jsnow@redhat.com
2015-03-19qtest/ahci: Fix a bit mask expressionJohn Snow
A thinko that clang 3.5.0 caught. Thankfully does not introduce any new failures. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-03-10qtest/ahci: add fragmented dma testJohn Snow
Test what happens when we try to use extremely short PRDTs to accomplish a small data transfer. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424905602-24715-7-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10qtest/ahci: Add PIO and LBA48 testsJohn Snow
In addition to DMA tests, test PIO and LBA48 command pathways in AHCI. To accomplish this, a primitive multiplexer for gtest is added. Though guests may prefer not to issue PIO commands directly except for single sector cases during early boot and shutdown, these pathways are still used for the transfer of ATAPI commands as well, and should be behaving well. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424905602-24715-6-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10qtest/ahci: Add DMA test variantsJohn Snow
These test a few different pathways in the AHCI code. short: Test the minimum transfer size, exactly one sector. simple: Test a transfer using a single PRD, in this case, 4K. double: Test transferring 8K, which we will split up as two PRDs. long: Test transferring a lot of data using many PRDs, 256K. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424905602-24715-5-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-03-10qtest/ahci: Add a macro bootup routineJohn Snow
Add a routine that can be used to engage the AHCI device at a not-granular level so that bringing up the functionality of the HBA is easy in future tests that are not concerned with testing the bring-up process. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424905602-24715-3-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-02-16qtest/ahci: Adding simple dma read-write testJohn Snow
Adds a test case for AHCI wherein we write a 4K block of a changing pattern to sector 0, then read back that 4K and compare the transmit and receive buffers. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1423158090-25580-20-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>