diff --git a/test/others/libcriu/lib.c b/test/others/libcriu/lib.c index 33aa4090d..0c7929cda 100644 --- a/test/others/libcriu/lib.c +++ b/test/others/libcriu/lib.c @@ -2,6 +2,8 @@ #include #include +#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()); +} diff --git a/test/others/libcriu/lib.h b/test/others/libcriu/lib.h index 67b784bff..6fdf8aef2 100644 --- a/test/others/libcriu/lib.h +++ b/test/others/libcriu/lib.h @@ -1,2 +1,3 @@ void what_err_ret_mean(int ret); int chk_exit(int status, int want); +int get_version(void); diff --git a/test/others/libcriu/test_self.c b/test/others/libcriu/test_self.c index c9d2a2e64..374a4b545 100644 --- a/test/others/libcriu/test_self.c +++ b/test/others/libcriu/test_self.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -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);