Difference between revisions of "ZDTM API"

From CRIU
Jump to navigation Jump to search
m
Line 13: Line 13:
 
;Checks
 
;Checks
 
: After restore test should verify whether everything is OK or not
 
: After restore test should verify whether everything is OK or not
 +
 +
This is achieved by using the following API calls:
 +
 +
;<code>test_init()</code>
 +
:Just initializes the test subsystem.
 +
 +
;<code>test_daemon()</code>
 +
:This one says that we finished preparations and ready to get dumped at any time.
 +
 +
;<code>test_waitsig()</code>
 +
:Calling this blocks the task till it's restored. After this the ''checks'' stage starts.
  
 
From the code perspective this looks like this:
 
From the code perspective this looks like this:
Line 34: Line 45:
 
}
 
}
 
</pre>
 
</pre>
 +
  
 
== Adding test to automatic suite ==
 
== Adding test to automatic suite ==
  
 
[[Category: Development]]
 
[[Category: Development]]

Revision as of 16:04, 23 January 2015

This page describes the API one should use to write new test in ZDTM.

API for test itself

The test should clearly describe 3 stages:

Preparations
These are actions that test does before the process(es) get checkpointed
Actions
During this the process(es) will be interrupted at arbitrary place and get dumped
Checks
After restore test should verify whether everything is OK or not

This is achieved by using the following API calls:

test_init()
Just initializes the test subsystem.
test_daemon()
This one says that we finished preparations and ready to get dumped at any time.
test_waitsig()
Calling this blocks the task till it's restored. After this the checks stage starts.

From the code perspective this looks like this:

int main(int argc, char **argv)
{
	test_init(argc, argv);

	/* preparations */

	test_daemon();

	/* actions */

	test_waitsig();

	/* checks */

	return 0;
}


Adding test to automatic suite