criu: Fault injection core

This patch(set) is inspired by similar from Andrey Vagin sent
sime time earlier.

The major idea is to artificially fail criu dump or restore at
specific places and let zdtm tests check whether failed dump
or restore resulted in anything bad.

This particular patch introduces the ability to tell criu "fail
at X point". Each point is specified with a integer constant
and with the next patches there will appear places over the
code checking for specific fail code being set and failing.

Two points are introduced -- early on dump, right after loading
the parasite and right after creation of the root task.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2015-10-13 18:06:30 +03:00
parent c405304fcc
commit 68baf8e77d
6 changed files with 58 additions and 1 deletions

19
include/fault-injection.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef __CR_FAULT_INJECTION_H__
#define __CR_FAULT_INJECTION_H__
#include <stdbool.h>
enum faults {
FI_NONE = 0,
FI_DUMP_EARLY,
FI_RESTORE_ROOT_ONLY,
FI_MAX,
};
extern enum faults fi_strategy;
extern int fault_injection_init(void);
static inline bool fault_injected(enum faults f)
{
return fi_strategy == f;
}
#endif