summaryrefslogtreecommitdiffstats
path: root/auto-virtserial.c
Commit message (Collapse)AuthorAgeFilesLines
* auto-test: check for <0 return for multi_open caseHEADmasterAmit Shah2013-04-241-1/+1
| | | | | | | | | | Instead of testing for -EMFILE, test for < 0 (error) for the multi-open case: -EMFILE is a bad error to report, -EBUSY is the right one for this case, and this was added to the upstream kernel in commit 2d57d36ef32e2d9073b0ca3e4e4b2dc32897932f so ensure we adapt to that change. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: console open not failing isn't fatalAmit Shah2013-03-151-2/+0
| | | | | | | | The test that checks for a console port to be opened shouldn't be fatal -- we can go ahead and interact with the console even if open succeeded or we got another error instead of -ENXIO. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Enable all tests at compile-time (instead of run-time)Amit Shah2011-09-141-4/+19
| | | | | | | | The tests were enabled at run-time to allow for some tests to be disabled. However, no way exists to disable tests non-programmatically, and any disabling can be done by just flipping the bit for that test. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Don't send OK message to guestAmit Shah2011-09-141-10/+2
| | | | | | | | | | | | | The guest doesn't do anything with the first STATUS_OK message we send; we anyway depend on the guest to contact us when it's up and running. This worked OK so far, but with newer kernels, the guest actually is up and running and sees this message from us, putting it in a confused state. Just don't send any message. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Bump poll timeout to 10s for guest->host big fileAmit Shah2011-05-241-2/+2
| | | | | | | | It might take a while for the host to clear out the data from the vq to a file on disk. The current timeout of 5s causes the poll to timeout quite frequently recently, so bump it to 10s. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Ensure we handle EINTR/EAGAIN on local file descriptorsAmit Shah2011-01-131-2/+30
| | | | | | | | | | For the guest and host file send functions, we could get EINTR or EAGAIN on local file descriptors. Ensure we handle that. Also, add a timeout to read() on the local descriptor to ensure we don't block forever on a guest that gets stuck. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Disable blocking and nonblocking write flood testsAmit Shah2010-10-201-0/+2
| | | | | | | These tests need qemu enhancements not yet upstream to work. They'll be enabled when the changes land in qemu.git. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Add test for blocking write caseAmit Shah2010-10-201-1/+61
| | | | | | | | | | | | | This testcase writes out lots of stuff to the host without reading anything out on the host. The guest should just go wait while the host clears out all the buffers. (Some badness caused the whole guest to freeze in this case, but a patch that should make it to stable kernels do just what's required.) This testcase is very similar to the nonblocking write testcase, as they check similar things. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* virtio: console: Enable non-blocking write "flooding" testAmit Shah2010-10-191-3/+21
| | | | | | | | | | | | | This test was added to test the case where a guest keeps writing to the host while the host doesn't consume any of the data. Without the nonblock patches, the guest used to freeze. Now, with the port fd opened in nonblocking mode, the guest returns -EAGAIN. This wasn't enabled so far as the guest just froze. All current kernels have this patch now, so enable it. Also ensure POLLOUT is set when some data from the host is consumed. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Close guest file descriptor if a test left it openAmit Shah2010-09-301-1/+1
| | | | | | | | | A test might lazily not close open guest file descriptors (like the older test_open() did on purpose or the test_multiple_open() does for laziness). Ensure we close the fd and also clear out the buffers if there were any queued up. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: combine open and close tests into oneAmit Shah2010-09-301-22/+8
| | | | | | | | | The post_test_cleanup operation should be able to close any open guest file descriptors as part of a lousy test function. Doing open and close in two different tests doesn't help that -- so let's combine them into one function. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Add test for lseek()Amit Shah2010-09-281-0/+34
| | | | | | | | | lseek() on console ports should fail with -ESPIPE. (This behaviour will be seen from kernel 2.6.37 onwards. Older kernels just returned success without seeking.) Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: poll() may have POLLIN set on host disconnectAmit Shah2010-09-161-0/+5
| | | | | | | | | | When testing for POLLHUP, we can also get POLLIN set, which makes our error checks go wrong. Make sure we unset POLLIN from the return value and then check for POLLHUP. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: don't poll further if last read() returned 0 in cleanupAmit Shah2010-09-161-3/+5
| | | | Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Shut down guest in case of running old kernel via virtio_consoleAmit Shah2010-09-161-0/+17
| | | | | | | | | | Older guest kernels will not have the guest program running to parse KEY_SHUTDOWN. Send the shutdown command via the console itself. (This requires first logging as root and then issuing the shutdown command) Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Shut down a guest after all tests are done.Amit Shah2010-09-131-0/+13
| | | | | | | | Currently we forcibly kill qemu from the run_test.sh script once each test is done. Instead, give a chance to the guest to shut itself down by sending a 'shutdown' command. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Add a test to check for blocking poll with SIGIO being invokedAmit Shah2010-08-261-0/+37
| | | | | | | | | With the process now capable of getting a SIGIO on incoming data, check if a poll() for POLLIN that was blocked behaves properly. This checks for both, the SIGIO delivery as well as poll output. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Add a key to specify poll events to poll forAmit Shah2010-08-261-7/+18
| | | | | | | | We always invoked a guest poll with POLLIN|POLLOUT events. There's a case where custom events might be necessary -- the sigio handler test, for example. Add a new key to set the poll events. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Add multiple open-close SIGIO testsAmit Shah2010-08-261-0/+44
| | | | | | | Test if multiple SIGIOs are sent for multiple host chardev open/close events for open ports in the same process. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Add test for testing SIGIO on new dataAmit Shah2010-08-261-0/+8
| | | | | | | The guest process should receive a SIGIO on not only host connect/disconnect events, but also on new data arrival on the port. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Add guest SIGIO testsAmit Shah2010-08-261-0/+57
| | | | | | | | | The guest can receive the SIGIO signal on host connection and disconnection events. This commit just adds a simple test for one open/close event. A lot more are to be added, as explained in the comments. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Explain how test_blocking_read() worksAmit Shah2010-08-261-0/+13
| | | | | | | There's some hackery in the way test_blocking_read() works, document it so that the move to autotest is easier. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Add a few sleep(2)s between host-guest commandsAmit Shah2010-08-261-0/+14
| | | | | | | | Give the guest to schedule in and react to input from the host before sending off results. Not doing this can result in some IO being missed and hence incorrect test results. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Introduce a threaded read/write testAmit Shah2010-08-231-0/+90
| | | | | | | | Introduce a test that creates a new thread and blocks on a port for read. The parent thread then writes to the port, and later the host writes something to the port, unblocking the read. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-virtserial: Wait for 90s instead of 40s for guest contactAmit Shah2010-08-041-2/+2
| | | | | | | | | RHEL5 guests are slow to start. 90s seems to be a good timeout to get contact from the guest. Haven't yet measured how much it really takes or even tried to optimise rhel5 booting beyond disabling unnecessary services. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Open guest->host file transfer in nonblocking mode on guestAmit Shah2010-05-051-0/+2
| | | | | | | | Let's see if this passes properly: The guest should get 'queue full' quite a few times given writing to a disk on the host via qemu's chardevs is slower than the guest giving us the data. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Don't run further tests if basic ones failAmit Shah2010-04-221-7/+27
| | | | | | | | Some basic tests like reading/writing from/to guests, opening files, etc., have to succeed. If they fail, we shouldn't attempt to run other tests. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Disable nonblocking write test till nonblock patches are upstreamAmit Shah2010-04-071-1/+1
| | | | | | | | Until writes become nonblocking, this test will just make sure the guest goes into an infinite loop in the kernel -- not something we want to happen. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: nonblocking write: Report 'pass' only if everything did passAmit Shah2010-04-071-1/+2
| | | | | | | In case of the nonblock test failing, we used to report both pass and fail. Report only failure. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Non-blocking write testAmit Shah2010-04-061-0/+71
| | | | | | | | | This new test puts a port in non-blocking mode in the guest and keeps sending data till the host can't accept any more. In this case, the vq is filled and the guest gets -EAGAIN on write. poll() should not return POLLOUT. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Don't run the host caching testAmit Shah2010-03-231-1/+2
| | | | | | | | | | The kernel module will gain blocking support for writes where an unopened host port will cause a write on the guest to block. This doesn't play well with the host caching test. And we don't cache data anyway. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: switch off host throttling, guest/host caching testsAmit Shah2010-01-271-1/+15
| | | | | | | | For all the cases that aren't included in the upstream code yet, switch off the tests so that we don't see failures for features not yet implemented. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: increase initial poll timeout to 40sAmit Shah2010-01-271-2/+2
| | | | | | | | 20s is insufficient for the guest to boot from a cold cache. Bump the timeout to 40s. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: guest throttling no longer neededAmit Shah2009-12-221-0/+7
| | | | | | | With the design change in the kernel module to have IO vqs for each port, guest throttling is no longer needed. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* autotest: put globals fn_name and bools of tests enabled in structAmit Shah2009-12-221-76/+123
| | | | Signed-off-by: Amit Shah <amit.shah@redhat.com>
* autotest: add function pointers to our test routines in an arrayAmit Shah2009-12-221-22/+39
| | | | | | | This is so that the main routine doesn't need to know the function name of the test to run. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* autotest: better debug stringAmit Shah2009-12-221-1/+1
| | | | | | it's not an error; so let's not say there was an error Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: add support for guest->host file sendAmit Shah2009-12-221-11/+139
| | | | | | Send file from guest->host and compare csums Signed-off-by: Amit Shah <amit.shah@redhat.com>
* autotest: close host chardevs after testAmit Shah2009-12-221-0/+2
| | | | Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Better debug messagesAmit Shah2009-11-261-2/+2
| | | | Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Bits for enabling/disabling individual testsAmit Shah2009-11-261-30/+48
| | | | | | Not yet configurable from the command line Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Fix return check for openAmit Shah2009-11-261-8/+8
| | | | | | | The return value from guest open should be >= 0, make sure we test for that instead of being = 0. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: guest caching: make sure data reaches guest port before ↵Amit Shah2009-11-041-0/+7
| | | | | | | | | | | | | announcing result In many cases the data got sent after the port was inspected for any cached data that was available in the cache disabled case. We can't rely on the sequence of the events; they can get rearranged so let's close the port only after we know the data reached the guest. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: guest_throttle: check for throttled after sufficient data has ↵Amit Shah2009-11-041-2/+2
| | | | | | | | | | been passed out the check for throttled sometimes fails; for the same reason that the guest caching test fails: less data is seen and the throttling condition isn't reached when it should. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: memset buffer to 0 before writing to guestAmit Shah2009-11-041-0/+2
| | | | | | | even though this is not used, this is done to suppress valgrind err messages Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: convert debug() into a func with varargs instead of it being a macroAmit Shah2009-10-291-4/+9
| | | | | | This is a much better way of doing it Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: Fix some warnings pointed out by clangAmit Shah2009-10-291-6/+7
| | | | | | | 1. don't assign to 'ret' the o/p of fns that we don't intend to use later 2. Ensure 'ret' actually contains the value we want Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: introduce a result() fn to check for pass/fail and show debug ↵Amit Shah2009-10-291-302/+274
| | | | | | | | | | | | | | messages Using individual pass/fail() functions, checking for conditions, printing debug message after fail each time can be optimised by using a result() function that can do all of that. This also allows us to make the test output format look prettier since it's all now handled in one function. So make the output prettier as well while we're at it. Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: add tests for checking sysfs, debugfs entries and udev rulesAmit Shah2009-10-271-0/+32
| | | | | | | | | | | | | | | This commit tests for: 1. sysfs entries created (the 'name' attribute) 2. debugfs entries created for ports (in /sys/kernel/debug/virtio-console/vconNN) (this needs debugfs to be mounted in /sys/kernel/debug) 3. udev rule that creates a symlink based on the port 'name' attribute (this needs a udev rule to create a symlink, like: KERNEL==vcon*, SYMLINK+=virtio-console/{name} in a file in the /etc/udev/rules.d/ directory) Signed-off-by: Amit Shah <amit.shah@redhat.com>
* auto-test: add test for opening of a port multiple timesAmit Shah2009-10-271-0/+24
| | | | | | Code should allow for having a port open only once in the guest. Signed-off-by: Amit Shah <amit.shah@redhat.com>