[CRIU] Re: [PATCH 1/3] zdtm: Add fifo-rowo-pair test case

Andrey Wagin avagin at gmail.com
Sun Jul 1 08:51:15 EDT 2012


2012/6/27 Cyrill Gorcunov <gorcunov at openvz.org>:
> I need a special test case where fake
> fifo will be created by us to restore
> the former.

Need more details about what and why this test case does

> +
> +       if (read(fd_master, &v, sizeof(v)) != sizeof(v)) {
> +               err("read failed: %m\n");
don't forget to kill a child
> +               exit(1);
> +       }
> +
> +       task_waiter_complete_current(&t);
> +
> +       if (v != 00100) {
> +               fail("read data mismatch\n");
> +               exit(1);
> +       }
> +
> +       if (read(fd_slave, &v, sizeof(v)) != sizeof(v)) {
> +               err("read failed: %m\n");
> +               exit(1);
> +       }
> +       if (v != 00100) {
Need to define the master data
> +               fail("read data mismatch\n");
> +               exit(1);
> +       }
> +
> +       waitpid(pid, &status, P_ALL);
> +
> +       if (unlink(name_master) < 0) {
> +               err("can't unlink %s: %m", name_master);
> +               exit(1);
> +       }
> +
> +       if (unlink(name_slave) < 0) {
> +               err("can't unlink %s: %m", name_slave);
> +               exit(1);
> +       }
> +
> +       errno = (status >> 8) & 0x7f;
use macroses WIFEXITED and WEXITSTATUS
> +       if (errno) {
> +               fail("Child exited with error %m");
> +               exit(errno);
> +       }
> +
> +       pass();
> +       return 0;
> +}
> --
> 1.7.7.6
>


More information about the CRIU mailing list