mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
This patches improves execution of zdtm tests.
It's really like in VZ. Signed-off-by: Andrey Vagin <avagin@openvz.org> Acked-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
parent
b601765782
commit
f00efadd2c
11
cr-restore.c
11
cr-restore.c
@ -1213,7 +1213,7 @@ static int restore_task_with_children(int my_pid)
|
||||
return restore_one_task(my_pid);
|
||||
}
|
||||
|
||||
static int restore_root_task(int fd)
|
||||
static int restore_root_task(int fd, bool detach)
|
||||
{
|
||||
struct pstree_entry e;
|
||||
int ret, i;
|
||||
@ -1240,11 +1240,12 @@ static int restore_root_task(int fd)
|
||||
pr_info("Go on!!!\n");
|
||||
cr_wait_set(&task_entries->start, 1);
|
||||
|
||||
wait(NULL);
|
||||
if (!detach)
|
||||
wait(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int restore_all_tasks(pid_t pid)
|
||||
static int restore_all_tasks(pid_t pid, bool detach)
|
||||
{
|
||||
int pstree_fd;
|
||||
u32 type = 0;
|
||||
@ -1256,7 +1257,7 @@ static int restore_all_tasks(pid_t pid)
|
||||
if (prepare_shared(pstree_fd))
|
||||
return -1;
|
||||
|
||||
return restore_root_task(pstree_fd);
|
||||
return restore_root_task(pstree_fd, detach);
|
||||
}
|
||||
|
||||
static long restorer_get_vma_hint(pid_t pid, struct list_head *self_vma_list, long vma_len)
|
||||
@ -1623,5 +1624,5 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts)
|
||||
|
||||
if (opts->leader_only)
|
||||
return restore_one_task(pid);
|
||||
return restore_all_tasks(pid);
|
||||
return restore_all_tasks(pid, opts->restore_detach);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ int main(int argc, char *argv[])
|
||||
int action = -1;
|
||||
int log_inited = 0;
|
||||
|
||||
static const char short_opts[] = "f:p:t:hcD:o:";
|
||||
static const char short_opts[] = "df:p:t:hcD:o:";
|
||||
|
||||
BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
|
||||
|
||||
@ -250,6 +250,9 @@ int main(int argc, char *argv[])
|
||||
case 'f':
|
||||
opts.show_dump_file = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
opts.restore_detach = true;
|
||||
break;
|
||||
case 'D':
|
||||
if (chdir(optarg)) {
|
||||
pr_perror("can't change working directory");
|
||||
@ -322,6 +325,7 @@ usage:
|
||||
printk(" -c in case of checkpoint -- continue running the process after\n"
|
||||
" checkpoint complete, in case of showing file contents --\n"
|
||||
" show contents of pages dumped in hexdump format\n");
|
||||
printk(" -d detach after restore\n");
|
||||
|
||||
printk("\nAdditional common parameters:\n");
|
||||
printk(" -D dir save checkpoint files in specified directory\n");
|
||||
|
@ -40,6 +40,7 @@ struct cr_options {
|
||||
enum cr_task_state final_state;
|
||||
bool show_pages_content;
|
||||
char *show_dump_file;
|
||||
bool restore_detach;
|
||||
};
|
||||
|
||||
/* file descriptors template */
|
||||
|
@ -44,11 +44,9 @@ run_test()
|
||||
echo Waiting...
|
||||
sleep 1
|
||||
done
|
||||
setsid $CRTOOLS restore -D $ddump -o restore.log -t $pid &
|
||||
sleep 1
|
||||
setsid $CRTOOLS restore -D $ddump -o restore.log -d -t $pid || return 1
|
||||
ls -l /proc/$pid/fd/
|
||||
make -C $tdir $tname.out
|
||||
wait || return 1
|
||||
for i in `seq 5`; do
|
||||
test -f $test.out && break;
|
||||
echo Waiting...
|
||||
|
Loading…
x
Reference in New Issue
Block a user