diff options
author | Blue Swirl | 2012-05-17 20:55:58 +0200 |
---|---|---|
committer | Blue Swirl | 2012-06-21 20:45:26 +0200 |
commit | 3359847e9dbdf4531ed17e86ef55be8b8676e329 (patch) | |
tree | a9b901afb4d7ce693b1e28c9da900f03fe25c798 /tests | |
parent | fdc: use LOG_UNIMP logging (diff) | |
download | qemu-3359847e9dbdf4531ed17e86ef55be8b8676e329.tar.gz qemu-3359847e9dbdf4531ed17e86ef55be8b8676e329.tar.xz qemu-3359847e9dbdf4531ed17e86ef55be8b8676e329.zip |
qtest: add a fuzz test to fdc-test
Add a simple register fuzzing test to floppy controller tests.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fdc-test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/fdc-test.c b/tests/fdc-test.c index e730398e7c..610e2f1e26 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -250,6 +250,22 @@ static void test_media_change(void) assert_bit_set(dir, DSKCHG); } +/* success if no crash or abort */ +static void fuzz_registers(void) +{ + unsigned int i; + + for (i = 0; i < 1000; i++) { + uint8_t reg, val; + + reg = (uint8_t)g_test_rand_int_range(0, 8); + val = (uint8_t)g_test_rand_int_range(0, 256); + + outb(FLOPPY_BASE + reg, val); + inb(FLOPPY_BASE + reg); + } +} + int main(int argc, char **argv) { const char *arch = qtest_get_arch(); @@ -281,6 +297,7 @@ int main(int argc, char **argv) qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start); qtest_add_func("/fdc/read_without_media", test_read_without_media); qtest_add_func("/fdc/media_change", test_media_change); + qtest_add_func("/fdc/fuzz-registers", fuzz_registers); ret = g_test_run(); |