diff --git a/test/zdtm.sh b/test/zdtm.sh index 8b8bcb4b4..cae8f8bdd 100755 --- a/test/zdtm.sh +++ b/test/zdtm.sh @@ -107,6 +107,7 @@ static/pty04 static/tty02 static/tty03 static/console +static/vt static/child_opened_proc static/cow01 static/fpu00 @@ -246,6 +247,7 @@ ns/static/clean_mntns ns/static/mntns_link_remap ns/static/mntns_link_ghost ns/static/console +ns/static/vt ns/static/rtc ns/static/mntns_shared_bind ns/static/mntns_shared_bind02 @@ -292,6 +294,7 @@ tun chroot chroot-file console +vt rtc tempfs maps007 diff --git a/test/zdtm/.gitignore b/test/zdtm/.gitignore index e244ccaab..31850df1a 100644 --- a/test/zdtm/.gitignore +++ b/test/zdtm/.gitignore @@ -168,6 +168,7 @@ /live/static/zombie00 /live/static/ip.dump /live/static/ip.rst +/live/static/vt /live/streaming/fifo_dyn /live/streaming/fifo_loop /live/streaming/file_aio diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile index 2e918e53a..b4cd62f92 100644 --- a/test/zdtm/live/static/Makefile +++ b/test/zdtm/live/static/Makefile @@ -139,6 +139,7 @@ TST_FILE = \ fifo_ro \ fifo_wronly \ console \ + vt \ unlink_fifo \ unlink_fifo_wronly \ unlink_mmap00 \ diff --git a/test/zdtm/live/static/vt.c b/test/zdtm/live/static/vt.c new file mode 100644 index 000000000..631a765f6 --- /dev/null +++ b/test/zdtm/live/static/vt.c @@ -0,0 +1,60 @@ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include + +#include +#include + +#include "zdtmtst.h" + +const char *test_doc = "Check c/r of a virtual terminal"; +const char *test_author = "Ruslan Kuprieiev "; + +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; +}