Changes

743 bytes added ,  16:11, 23 January 2015
no edit summary
Line 5: Line 5:  
The test should clearly describe 3 stages:
 
The test should clearly describe 3 stages:
   −
; Preparations
+
;Preparations
 
: These are actions that test does before the process(es) get checkpointed
 
: These are actions that test does before the process(es) get checkpointed
   Line 12: Line 12:     
;Checks
 
;Checks
: After restore test should verify whether everything is OK or not
+
: After restore test should verify whether everything is OK or not and report the result
    
This is achieved by using the following API calls:
 
This is achieved by using the following API calls:
   −
;<code>test_init()</code>
+
;<code>test_init(argc, argv)</code>
:Just initializes the test subsystem.
+
:Just initializes the test subsystem. After this call the preparations stage starts.
    
;<code>test_daemon()</code>
 
;<code>test_daemon()</code>
:This one says that we finished preparations and ready to get dumped at any time.
+
:This one says that we finished preparations and ready to get dumped at any time. I.e. -- the ''actions'' begin.
 +
 
 +
;<code>test_go()</code>
 +
:This routine checks whether the process was dumped and restored or not yet, i.e. the ''actions'' stage still goes on.
    
;<code>test_waitsig()</code>
 
;<code>test_waitsig()</code>
 
:Calling this blocks the task till it's restored. After this the ''checks'' stage starts.
 
:Calling this blocks the task till it's restored. After this the ''checks'' stage starts.
 +
 +
;<code>pass()</code>
 +
:Calling this marks test as PASSED
 +
 +
;<code>fail(message)</code>
 +
:Calling this would report test failure. The ''message'' argument will be written into logs
 +
 +
;<code>err(message)</code>
 +
:Use this function to mark the test as being unable to work at all.
 +
 +
;<code>test_msg(message)</code>
 +
:This is for logging.
 +
    
From the code perspective this looks like this:
 
From the code perspective this looks like this:
Line 32: Line 48:  
test_init(argc, argv);
 
test_init(argc, argv);
   −
/* preparations */
+
/* Preparations */
    
test_daemon();
 
test_daemon();
   −
/* actions */
+
#if test want to act and get c/r-ed unexpectedly
 +
while (test_go()) {
 +
/* Actions go here */
 +
}
 +
#else test just want to wait for c/r to happen
 +
/* Actions go here. */
    
test_waitsig();
 
test_waitsig();
 +
#endif
    
/* checks */
 
/* checks */