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:
Adrian Reber 2020-04-23 14:28:00 +00:00 committed by Andrei Vagin
parent ce6e00ba98
commit 76db45331c
3 changed files with 20 additions and 1 deletions

View file

@ -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());
}

View file

@ -1,2 +1,3 @@
void what_err_ret_mean(int ret);
int chk_exit(int status, int want);
int get_version(void);

View file

@ -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);