mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-23 10:09:57 +00:00
test/others/libcriu: test version library calls
This adds the previously added libcriu version functions to the libcriu tests. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
ce6e00ba98
commit
76db45331c
3 changed files with 20 additions and 1 deletions
|
|
@ -2,6 +2,8 @@
|
|||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "criu.h"
|
||||
|
||||
void what_err_ret_mean(int ret)
|
||||
{
|
||||
/* NOTE: errno is set by libcriu */
|
||||
|
|
@ -44,4 +46,7 @@ int chk_exit(int status, int want)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int get_version()
|
||||
{
|
||||
printf("Using a CRIU binary with version %d\n", criu_get_version());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
void what_err_ret_mean(int ret);
|
||||
int chk_exit(int status, int want);
|
||||
int get_version(void);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
|
@ -23,6 +24,18 @@ int main(int argc, char *argv[])
|
|||
|
||||
criu_init_opts();
|
||||
criu_set_service_binary(argv[1]);
|
||||
|
||||
get_version();
|
||||
if (!criu_check_version(31400)) {
|
||||
printf("CRIU version check failed. CRIU too old\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (criu_check_version(INT_MAX)) {
|
||||
printf("CRIU version check failed. CRIU too new.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
criu_set_images_dir_fd(fd);
|
||||
criu_set_log_level(4);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue