Commit 16a668e5 authored by Ruslan Kuprieiev's avatar Ruslan Kuprieiev Committed by Pavel Emelyanov

zdtm:tty:vt: add simple test

Inspired by static/console test.
Signed-off-by: 's avatarRuslan Kuprieiev <kupruser@gmail.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1ace2570
...@@ -107,6 +107,7 @@ static/pty04 ...@@ -107,6 +107,7 @@ static/pty04
static/tty02 static/tty02
static/tty03 static/tty03
static/console static/console
static/vt
static/child_opened_proc static/child_opened_proc
static/cow01 static/cow01
static/fpu00 static/fpu00
...@@ -246,6 +247,7 @@ ns/static/clean_mntns ...@@ -246,6 +247,7 @@ ns/static/clean_mntns
ns/static/mntns_link_remap ns/static/mntns_link_remap
ns/static/mntns_link_ghost ns/static/mntns_link_ghost
ns/static/console ns/static/console
ns/static/vt
ns/static/rtc ns/static/rtc
ns/static/mntns_shared_bind ns/static/mntns_shared_bind
ns/static/mntns_shared_bind02 ns/static/mntns_shared_bind02
...@@ -292,6 +294,7 @@ tun ...@@ -292,6 +294,7 @@ tun
chroot chroot
chroot-file chroot-file
console console
vt
rtc rtc
tempfs tempfs
maps007 maps007
......
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
/live/static/zombie00 /live/static/zombie00
/live/static/ip.dump /live/static/ip.dump
/live/static/ip.rst /live/static/ip.rst
/live/static/vt
/live/streaming/fifo_dyn /live/streaming/fifo_dyn
/live/streaming/fifo_loop /live/streaming/fifo_loop
/live/streaming/file_aio /live/streaming/file_aio
......
...@@ -139,6 +139,7 @@ TST_FILE = \ ...@@ -139,6 +139,7 @@ TST_FILE = \
fifo_ro \ fifo_ro \
fifo_wronly \ fifo_wronly \
console \ console \
vt \
unlink_fifo \ unlink_fifo \
unlink_fifo_wronly \ unlink_fifo_wronly \
unlink_mmap00 \ unlink_mmap00 \
......
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "zdtmtst.h"
const char *test_doc = "Check c/r of a virtual terminal";
const char *test_author = "Ruslan Kuprieiev <kupruser@gmail.com>";
char *filename;
TEST_OPTION(filename, string, "file name", 1);
int main(int argc, char **argv)
{
struct stat st1, st2;
int fd;
test_init(argc, argv);
if (mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, makedev(4, 5))) {
err("Can't create virtual terminal %s", filename);
return 1;
}
fd = open(filename, O_RDONLY);
if (fd < 0) {
err("Open virtual terminal %s failed", filename);
return 1;
}
if (fstat(fd, &st1)) {
err("Can't stat %s virtual terminal", filename);
return 1;
}
test_daemon();
test_waitsig();
if (fstat(fd, &st2)) {
err("Can't stat %s virtual terminal", filename);
return 1;
}
if (st1.st_rdev != st2.st_rdev) {
fail("Virtual terminal rdev mismatch %x != %x on %s",
(int)st1.st_rdev, (int)st2.st_rdev,
filename);
return 1;
}
pass();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment