Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
6 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <stdlib.h> | ||
#include "fault-injection.h" | ||
|
||
enum faults fi_strategy; | ||
|
||
int fault_injection_init() | ||
{ | ||
char *val; | ||
int strat; | ||
|
||
val = getenv("CRIU_FAULT"); | ||
if (val == NULL) | ||
return 0; | ||
|
||
strat = atoi(val); | ||
|
||
if (strat <= 0 || strat >= FI_MAX) | ||
return -1; | ||
|
||
fi_strategy = strat; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |