diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-09-30 13:50:22 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2010-09-30 13:50:22 +0530 |
commit | 692adad718e7655203768ae0d16f52b0cabeb91f (patch) | |
tree | b7195d2dacbc912e4ad066afed913d97faae9dfa | |
parent | da4085786b76598d279996c8e6ee87d3fa6a8da1 (diff) | |
download | test-virtserial-692adad718e7655203768ae0d16f52b0cabeb91f.tar.gz test-virtserial-692adad718e7655203768ae0d16f52b0cabeb91f.tar.xz test-virtserial-692adad718e7655203768ae0d16f52b0cabeb91f.zip |
auto-test: combine open and close tests into one
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>
-rw-r--r-- | auto-virtserial.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c index fb3f40f..7faccbb 100644 --- a/auto-virtserial.c +++ b/auto-virtserial.c @@ -385,12 +385,15 @@ static int result(const char *test, const bool enabled, const char *stage, return r; } -static int test_open(int nr) +static int test_open_close(int nr) { int ret; ret = guest_open_port(nr); - return result(__func__, true, "open", ret, -1, -1, OP_GT, true); + result(__func__, true, "open", ret, -1, -1, OP_GT, true); + + ret = guest_close_port(nr); + return result(__func__, true, "close", ret, 0, 0, OP_EQ, true); } static int test_multiple_open(int nr) @@ -411,14 +414,6 @@ static int test_multiple_open(int nr) return err; } -static int test_close(int nr) -{ - int ret; - - ret = guest_close_port(nr); - return result(__func__, true, "close", ret, 0, 0, OP_EQ, true); -} - static int test_sysfs_and_udev(int nr) { struct guest_packet gpkt; @@ -1415,8 +1410,7 @@ static int test_sigio_handler(int nr) } enum { - TEST_OPEN = 0, - TEST_CLOSE, + TEST_OPEN_CLOSE = 0, TEST_MULTI_OPEN, TEST_SYSFS_UDEV, TEST_READ_WO_HOST, @@ -1444,11 +1438,7 @@ static struct test_parameters { bool needs_guestok; } tests[TEST_END] = { { - .test_function = test_open, - .needs_guestok = true, - }, - { - .test_function = test_close, + .test_function = test_open_close, .needs_guestok = true, }, { @@ -1580,11 +1570,7 @@ static int start_tests(void) * on an incompatible kernel or qemu version. */ - ret = run_test(TEST_OPEN, 2); - if (ret) - return ret; - - ret = run_test(TEST_CLOSE, 2); + ret = run_test(TEST_OPEN_CLOSE, 2); if (ret) return ret; |