summaryrefslogtreecommitdiffstats
path: root/auto-virtserial.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-10-27 21:51:35 +0530
committerAmit Shah <amit.shah@redhat.com>2009-10-27 22:01:38 +0530
commit17d67594540f587d9d04adbe128daf907ff1b8e5 (patch)
tree2ca29128eb00310bb189837e9813c52b237f3d85 /auto-virtserial.c
parent74ab3612c25320b60bab817b934441ae1d85b6e6 (diff)
downloadtest-virtserial-17d67594540f587d9d04adbe128daf907ff1b8e5.tar.gz
test-virtserial-17d67594540f587d9d04adbe128daf907ff1b8e5.tar.xz
test-virtserial-17d67594540f587d9d04adbe128daf907ff1b8e5.zip
auto-test: add tests for checking sysfs, debugfs entries and udev rules
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>
Diffstat (limited to 'auto-virtserial.c')
-rw-r--r--auto-virtserial.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c
index 1776615..1fa7208 100644
--- a/auto-virtserial.c
+++ b/auto-virtserial.c
@@ -305,6 +305,35 @@ static int test_close(int nr)
return ret;
}
+static int test_sysfs_and_udev(int nr)
+{
+ struct guest_packet gpkt;
+ int ret;
+
+ gpkt.key = KEY_CHECK_SYSFS;
+ gpkt.value = nr;
+ ret = guest_cmd(&gpkt);
+ if (ret < 0) {
+ fail(__func__, "sysfs");
+ if (ret == -ERANGE)
+ debug("%s: no name specified for port %u\n",
+ __func__, nr);
+ else
+ debug("%s: ret = %d\n", __func__, ret);
+ return ret;
+ }
+ gpkt.key = KEY_CHECK_UDEV;
+ gpkt.value = nr;
+ ret = guest_cmd(&gpkt);
+ if (ret < 0) {
+ fail(__func__, "udev");
+ debug("%s: ret = %d\n", __func__, ret);
+ } else {
+ pass(__func__, "sysfs-udev");
+ }
+ return ret;
+}
+
/* Reads should return 0 when host chardev isn't connected */
static int test_read_without_host(int nr)
{
@@ -948,6 +977,9 @@ static int start_tests(void)
test_open(2);
test_close(2);
test_multiple_open(2);
+
+ test_sysfs_and_udev(2);
+
test_read_without_host(2);
test_blocking_read(2);