diff --git a/0003-Covscan-warnings-and-fail_if-deprication.patch b/0003-Covscan-warnings-and-fail_if-deprication.patch new file mode 100644 index 0000000..8d04ef8 --- /dev/null +++ b/0003-Covscan-warnings-and-fail_if-deprication.patch @@ -0,0 +1,268 @@ +From fd9d39cf19084dd4244943a3b27ee0a33805f76d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Mon, 21 Jun 2021 15:04:51 +0200 +Subject: [PATCH 1/2] Fix important covscan warnings + +- covscan thinks we are leaking storage from `g_strndup` so be more +explicit that `g_strstrip` is in place. +--- + librepo/downloader.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/librepo/downloader.c b/librepo/downloader.c +index c5278fbc..f4e8ba2a 100644 +--- a/librepo/downloader.c ++++ b/librepo/downloader.c +@@ -494,7 +494,10 @@ lr_headercb(void *ptr, size_t size, size_t nmemb, void *userdata) + return lr_zckheadercb(ptr, size, nmemb, userdata); + #endif /* WITH_ZCHUNK */ + +- char *header = g_strstrip(g_strndup(ptr, size*nmemb)); ++ char *header = g_strndup(ptr, size*nmemb); ++ // strips in place ++ g_strstrip(header); ++ + gint64 expected = lrtarget->target->expectedsize; + + if (state == LR_HCS_DEFAULT) { + +From 5a9e9e99c64e2dc1d181fa14cf348c7f51611a7a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Mon, 21 Jun 2021 15:05:13 +0200 +Subject: [PATCH 2/2] Fix covscan warnings + +- remove unused code +- missing return value checks +- use mkstemp just like other tests +--- + librepo/handle.c | 12 +++++++++--- + tests/test_downloader.c | 40 ++++++++++++++++++++-------------------- + tests/test_repoconf.c | 22 +++------------------- + 3 files changed, 32 insertions(+), 42 deletions(-) + +diff --git a/librepo/handle.c b/librepo/handle.c +index 8ac7234c..2c23ed09 100644 +--- a/librepo/handle.c ++++ b/librepo/handle.c +@@ -628,7 +628,7 @@ lr_handle_setopt(LrHandle *handle, + "Value of LRO_LOWSPEEDTIME is too low."); + ret = FALSE; + } else { +- curl_easy_setopt(c_h, CURLOPT_LOW_SPEED_TIME, val_long); ++ c_rc = curl_easy_setopt(c_h, CURLOPT_LOW_SPEED_TIME, val_long); + handle->lowspeedtime = val_long; + } + +@@ -648,7 +648,7 @@ lr_handle_setopt(LrHandle *handle, + val_long, handle->maxspeed); + ret = FALSE; + } else { +- curl_easy_setopt(c_h, CURLOPT_LOW_SPEED_LIMIT, val_long); ++ c_rc = curl_easy_setopt(c_h, CURLOPT_LOW_SPEED_LIMIT, val_long); + handle->lowspeedlimit = val_long; + } + +@@ -885,7 +885,13 @@ lr_yum_download_url_retry(int attempts, LrHandle *lr_handle, const char *url, + + g_debug("%s: Attempt #%d to download %s failed: %s", + __func__, i, url, (*err)->message); +- ftruncate(fd, 0); ++ ++ if (ftruncate(fd, 0) < 0) { ++ g_set_error(err, LR_DOWNLOADER_ERROR, LRE_IO, ++ "ftruncate() failed: %s", g_strerror(errno)); ++ return FALSE; ++ } ++ + g_clear_error (err); + } + } +diff --git a/tests/test_downloader.c b/tests/test_downloader.c +index 3a1c60f4..e6155105 100644 +--- a/tests/test_downloader.c ++++ b/tests/test_downloader.c +@@ -46,7 +46,7 @@ START_TEST(test_downloader_single_file) + fail_if(handle == NULL); + + char *urls[] = {"http://www.google.com", NULL}; +- lr_handle_setopt(handle, NULL, LRO_URLS, urls); ++ fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); + fail_if(tmp_err); + +@@ -55,8 +55,7 @@ START_TEST(test_downloader_single_file) + + tmpfn1 = lr_pathconcat(test_globals.tmpdir, "single_file_XXXXXX", NULL); + +- mktemp(tmpfn1); +- fd1 = open(tmpfn1, O_RDWR|O_CREAT|O_TRUNC, 0666); ++ fd1 = mkstemp(tmpfn1); + lr_free(tmpfn1); + fail_if(fd1 < 0); + +@@ -86,6 +85,7 @@ START_TEST(test_downloader_single_file) + } + + g_slist_free_full(list, (GDestroyNotify) lr_downloadtarget_free); ++ close(fd1); + } + END_TEST + +@@ -102,8 +102,7 @@ START_TEST(test_downloader_single_file_2) + + tmpfn1 = lr_pathconcat(test_globals.tmpdir, "single_file_2_XXXXXX", NULL); + +- mktemp(tmpfn1); +- fd1 = open(tmpfn1, O_RDWR|O_CREAT|O_TRUNC, 0666); ++ fd1 = mkstemp(tmpfn1); + lr_free(tmpfn1); + fail_if(fd1 < 0); + +@@ -131,6 +130,7 @@ START_TEST(test_downloader_single_file_2) + } + + g_slist_free_full(list, (GDestroyNotify) lr_downloadtarget_free); ++ close(fd1); + } + END_TEST + +@@ -151,7 +151,7 @@ START_TEST(test_downloader_two_files) + fail_if(handle == NULL); + + char *urls[] = {"http://www.google.com", NULL}; +- lr_handle_setopt(handle, NULL, LRO_URLS, urls); ++ fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); + fail_if(tmp_err); + +@@ -160,10 +160,8 @@ START_TEST(test_downloader_two_files) + tmpfn1 = lr_pathconcat(test_globals.tmpdir, "single_file_1_XXXXXX", NULL); + tmpfn2 = lr_pathconcat(test_globals.tmpdir, "single_file_2_XXXXXX", NULL); + +- mktemp(tmpfn1); +- mktemp(tmpfn2); +- fd1 = open(tmpfn1, O_RDWR|O_CREAT|O_TRUNC, 0666); +- fd2 = open(tmpfn2, O_RDWR|O_CREAT|O_TRUNC, 0666); ++ fd1 = mkstemp(tmpfn1); ++ fd2 = mkstemp(tmpfn2); + lr_free(tmpfn1); + lr_free(tmpfn2); + fail_if(fd1 < 0); +@@ -200,6 +198,8 @@ START_TEST(test_downloader_two_files) + } + + g_slist_free_full(list, (GDestroyNotify) lr_downloadtarget_free); ++ close(fd1); ++ close(fd2); + } + END_TEST + +@@ -220,7 +220,7 @@ START_TEST(test_downloader_three_files_with_error) + fail_if(handle == NULL); + + char *urls[] = {"http://www.google.com", NULL}; +- lr_handle_setopt(handle, NULL, LRO_URLS, urls); ++ fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); + fail_if(tmp_err); + +@@ -230,12 +230,9 @@ START_TEST(test_downloader_three_files_with_error) + tmpfn2 = lr_pathconcat(test_globals.tmpdir, "single_file_2_XXXXXX", NULL); + tmpfn3 = lr_pathconcat(test_globals.tmpdir, "single_file_3_XXXXXX", NULL); + +- mktemp(tmpfn1); +- mktemp(tmpfn2); +- mktemp(tmpfn3); +- fd1 = open(tmpfn1, O_RDWR|O_CREAT|O_TRUNC, 0666); +- fd2 = open(tmpfn2, O_RDWR|O_CREAT|O_TRUNC, 0666); +- fd3 = open(tmpfn3, O_RDWR|O_CREAT|O_TRUNC, 0666); ++ fd1 = mkstemp(tmpfn1); ++ fd2 = mkstemp(tmpfn2); ++ fd3 = mkstemp(tmpfn3); + lr_free(tmpfn1); + lr_free(tmpfn2); + lr_free(tmpfn3); +@@ -290,6 +287,9 @@ START_TEST(test_downloader_three_files_with_error) + } + + g_slist_free_full(list, (GDestroyNotify) lr_downloadtarget_free); ++ close(fd1); ++ close(fd2); ++ close(fd3); + } + END_TEST + +@@ -331,7 +331,7 @@ START_TEST(test_downloader_checksum) + fail_if(handle == NULL); + + char *urls[] = {"file:///", NULL}; +- lr_handle_setopt(handle, NULL, LRO_URLS, urls); ++ fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); + fail_if(tmp_err); + +@@ -340,8 +340,7 @@ START_TEST(test_downloader_checksum) + + tmpfn1 = lr_pathconcat(test_globals.tmpdir, "single_file_XXXXXX", NULL); + +- mktemp(tmpfn1); +- fd1 = open(tmpfn1, O_RDWR|O_CREAT|O_TRUNC, 0666); ++ fd1 = mkstemp(tmpfn1); + lr_free(tmpfn1); + fail_if(fd1 < 0); + +@@ -382,6 +381,7 @@ START_TEST(test_downloader_checksum) + } + + g_slist_free_full(list, (GDestroyNotify) lr_downloadtarget_free); ++ close(fd1); + } + } + END_TEST +diff --git a/tests/test_repoconf.c b/tests/test_repoconf.c +index 8a56b666..5c85047e 100644 +--- a/tests/test_repoconf.c ++++ b/tests/test_repoconf.c +@@ -33,22 +33,6 @@ repoconf_assert_true(LrYumRepoConf *repoconf, + #define conf_assert_true(option) \ + repoconf_assert_true(conf, (option)) + +-static void +-repoconf_assert_false(LrYumRepoConf *repoconf, +- LrYumRepoConfOption option) +-{ +- ck_assert(1); +- long val = 1L; +- _cleanup_error_free_ GError *tmp_err = NULL; +- gboolean ret = lr_yum_repoconf_getinfo(repoconf, &tmp_err, option, &val); +- ck_assert(!tmp_err); +- ck_assert(ret); +- ck_assert_msg(!val, "Not a 0 (False) value (Option %d)", option); +-} +- +-#define conf_assert_false(option) \ +- repoconf_assert_false(conf, (option)) +- + static void + repoconf_assert_na(LrYumRepoConf *repoconf, + LrYumRepoConfOption option) +@@ -509,7 +493,7 @@ END_TEST + + START_TEST(test_write_repoconf) + { +- _cleanup_fd_close_ int rc = -1; ++ _cleanup_fd_close_ int fd = -1; + gboolean ret; + LrYumRepoConfs *confs; + LrYumRepoConf * conf; +@@ -519,8 +503,8 @@ START_TEST(test_write_repoconf) + _cleanup_error_free_ GError *tmp_err = NULL; + + // Create a temporary file +- rc = mkstemp(tmpfn); +- fail_if(rc == -1); ++ fd = mkstemp(tmpfn); ++ fail_if(fd == -1); + + // Create reconfs with one repoconf with one id (one section) + confs = lr_yum_repoconfs_init(); diff --git a/0004-fail_if-and-fail_unless-are-deprecated.patch b/0004-fail_if-and-fail_unless-are-deprecated.patch new file mode 100644 index 0000000..c3ca3fc --- /dev/null +++ b/0004-fail_if-and-fail_unless-are-deprecated.patch @@ -0,0 +1,2426 @@ +From 3738ee93ebcc3552774b6361fccea2b8ab80e101 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Tue, 22 Jun 2021 10:32:29 +0200 +Subject: [PATCH] `fail_if` and `fail_unless` are deprecated + +https://libcheck.github.io/check/doc/check_html/check_4.html#Convenience-Test-Functions + +It also fixes a couple of covscan warnings of the following type: +``` +Error: COMPILER_WARNING (CWE-685): +librepo-1.12.1/tests/fixtures.h:5: included_from: Included from here. +librepo-1.12.1/tests/test_checksum.c:15: included_from: Included from here. +librepo-1.12.1/tests/test_checksum.c: scope_hint: In function 'test_checksum' +librepo-1.12.1/tests/test_checksum.c:58:9: warning[-Wformat-extra-args]: too many arguments for format +\# 58 | "Checksum is %s instead of %s", checksum, expected); +\# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\# 56| fail_if(tmp_err); +\# 57| fail_if(strcmp(checksum, expected), +\# 58|-> "Checksum is %s instead of %s", checksum, expected); +\# 59| lr_free(checksum); +\# 60| close(fd); +``` +--- + tests/test_checksum.c | 88 +++---- + tests/test_downloader.c | 93 +++---- + tests/test_gpg.c | 32 +-- + tests/test_handle.c | 140 +++++----- + tests/test_lrmirrorlist.c | 114 ++++----- + tests/test_metalink.c | 438 ++++++++++++++++---------------- + tests/test_mirrorlist.c | 40 +-- + tests/test_package_downloader.c | 48 ++-- + tests/test_repo_zck.c | 20 +- + tests/test_repoconf.c | 24 +- + tests/test_repomd.c | 38 +-- + tests/test_url_substitution.c | 50 ++-- + tests/test_util.c | 146 +++++------ + tests/test_version.c | 24 +- + 14 files changed, 640 insertions(+), 655 deletions(-) + +diff --git a/tests/test_checksum.c b/tests/test_checksum.c +index d0aba365..cd28cd17 100644 +--- a/tests/test_checksum.c ++++ b/tests/test_checksum.c +@@ -38,8 +38,8 @@ build_test_file(const char *filename, const char *content) + { + FILE *fp = fopen(filename, "w"); + size_t len = strlen(content); +- fail_if(fp == NULL); +- fail_unless(fwrite(content, 1, len, fp) == len); ++ ck_assert_ptr_nonnull(fp); ++ ck_assert(fwrite(content, 1, len, fp) == len); + fclose(fp); + } + +@@ -51,11 +51,11 @@ test_checksum(const char *filename, LrChecksumType ch_type, char *expected) + GError *tmp_err = NULL; + + fd = open(filename, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + checksum = lr_checksum_fd(ch_type, fd, &tmp_err); +- fail_if(checksum == NULL); +- fail_if(tmp_err); +- fail_if(strcmp(checksum, expected), ++ ck_assert_ptr_nonnull(checksum); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert_msg(!strcmp(checksum, expected), + "Checksum is %s instead of %s", checksum, expected); + lr_free(checksum); + close(fd); +@@ -85,7 +85,7 @@ START_TEST(test_checksum_fd) + test_checksum(file, LR_CHECKSUM_SHA384, CHKS_VAL_01_SHA384); + test_checksum(file, LR_CHECKSUM_SHA512, CHKS_VAL_01_SHA512); + +- fail_if(remove(file) != 0, "Cannot delete temporary test file"); ++ ck_assert_msg(remove(file) == 0, "Cannot delete temporary test file"); + lr_free(file); + } + END_TEST +@@ -107,28 +107,28 @@ START_TEST(test_cached_checksum_matches) + + filename = lr_pathconcat(test_globals.tmpdir, "/test_checksum_matches", NULL); + f = fopen(filename, "w"); +- fail_if(f == NULL); ++ ck_assert_ptr_nonnull(f); + fwrite("foo\nbar\n", 1, 8, f); + fclose(f); + + // Assert no cached checksum exists + attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret != -1); // Cached timestamp should not exists ++ ck_assert(attr_ret == -1); // Cached timestamp should not exists + attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret != -1); // Cached checksum should not exists ++ ck_assert(attr_ret == -1); // Cached checksum should not exists + + // Calculate checksum + fd = open(filename, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + checksum_ret = lr_checksum_fd_cmp(LR_CHECKSUM_SHA256, + fd, + expected, + 1, + &matches, + &tmp_err); +- fail_if(tmp_err); +- fail_if(!checksum_ret); +- fail_if(!matches); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(checksum_ret); ++ ck_assert(matches); + close(fd); + + // Assert cached checksum exists +@@ -141,33 +141,33 @@ START_TEST(test_cached_checksum_matches) + goto exit_label; + } + // Any other errno means fail +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + } else { + buf[attr_ret] = 0; +- fail_if(strcmp(buf, expected)); ++ ck_assert_str_eq(buf, expected); + } + + // stored timestamp matches the file mtime + ret = stat(filename, &st); +- fail_if(ret != 0); ++ ck_assert_int_eq(ret, 0); + mtime_str = g_strdup_printf("%lli", (long long) st.st_mtime); + attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + buf[attr_ret] = 0; +- fail_if(strcmp(buf, mtime_str)); ++ ck_assert_str_eq(buf, mtime_str); + + // Calculate checksum again (cached shoud be used this time) + fd = open(filename, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + checksum_ret = lr_checksum_fd_cmp(LR_CHECKSUM_SHA256, + fd, + expected, + 1, + &matches, + &tmp_err); +- fail_if(tmp_err); +- fail_if(!checksum_ret); +- fail_if(!matches); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(checksum_ret); ++ ck_assert(matches); + close(fd); + + exit_label: +@@ -195,19 +195,19 @@ START_TEST(test_cached_checksum_value) + + filename = lr_pathconcat(test_globals.tmpdir, "/test_checksum_value", NULL); + f = fopen(filename, "w"); +- fail_if(f == NULL); ++ ck_assert_ptr_nonnull(f); + fwrite("foo\nbar\n", 1, 8, f); + fclose(f); + + // Assert no cached checksum exists + attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret != -1); // Cached timestamp should not exists ++ ck_assert(attr_ret == -1); // Cached timestamp should not exists + attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret != -1); // Cached checksum should not exists ++ ck_assert(attr_ret == -1); // Cached checksum should not exists + + // Calculate checksum + fd = open(filename, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + checksum_ret = lr_checksum_fd_compare(LR_CHECKSUM_SHA256, + fd, + "", +@@ -215,20 +215,20 @@ START_TEST(test_cached_checksum_value) + &matches, + &calculated, + &tmp_err); +- fail_if(tmp_err); +- fail_if(!checksum_ret); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(checksum_ret); + // We pass in an empty string for expected, so we must not match. +- fail_if(matches); ++ ck_assert(!matches); + close(fd); +- fail_if(strcmp(calculated, expected)); ++ ck_assert_str_eq(calculated, expected); + + // Assert no cached checksum exists + // This assumes issue #235 is unresolved. Once it is, this code + // should fail and the test will need updated. + attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret != -1); // Cached timestamp should not exists ++ ck_assert(attr_ret == -1); // Cached timestamp should not exists + attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)-1); +- fail_if(attr_ret != -1); // Cached checksum should not exists ++ ck_assert(attr_ret == -1); // Cached checksum should not exists + + lr_free(calculated); + lr_free(filename); +@@ -252,42 +252,42 @@ START_TEST(test_cached_checksum_clear) + + filename = lr_pathconcat(test_globals.tmpdir, "/test_checksum_clear", NULL); + f = fopen(filename, "w"); +- fail_if(f == NULL); ++ ck_assert_ptr_nonnull(f); + fclose(f); + + // set extended attributes + fd = open(filename, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + attr_ret = FSETXATTR(fd, timestamp_key, value, strlen(value), 0); + if (attr_ret == -1) { + if (errno == ENOTSUP) { + goto cleanup; + } +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + } + attr_ret = FSETXATTR(fd, checksum_key, value, strlen(value), 0); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + attr_ret = FSETXATTR(fd, other_key, value, strlen(value), 0); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + + // verify that xattrs are set + attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + attr_ret = GETXATTR(filename, other_key, &buf, sizeof(buf)); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + + lr_checksum_clear_cache(fd); + + // verify that checksum xattrs are removed + attr_ret = GETXATTR(filename, timestamp_key, &buf, sizeof(buf)); +- fail_if(attr_ret != -1); ++ ck_assert(attr_ret == -1); + attr_ret = GETXATTR(filename, checksum_key, &buf, sizeof(buf)); +- fail_if(attr_ret != -1); ++ ck_assert(attr_ret == -1); + // other then checksum related attributes are not removed + attr_ret = GETXATTR(filename, other_key, &buf, sizeof(buf)); +- fail_if(attr_ret == -1); ++ ck_assert(attr_ret != -1); + cleanup: + close(fd); + lr_free(filename); +diff --git a/tests/test_downloader.c b/tests/test_downloader.c +index e6155105..34958ab1 100644 +--- a/tests/test_downloader.c ++++ b/tests/test_downloader.c +@@ -20,18 +20,14 @@ + + START_TEST(test_downloader_no_list) + { +- int ret; + GError *err = NULL; +- +- ret = lr_download(NULL, FALSE, &err); +- fail_if(!ret); +- fail_if(err); ++ ck_assert(lr_download(NULL, FALSE, &err)); ++ ck_assert_ptr_null(err); + } + END_TEST + + START_TEST(test_downloader_single_file) + { +- int ret; + LrHandle *handle; + GSList *list = NULL; + GError *err = NULL; +@@ -43,12 +39,12 @@ START_TEST(test_downloader_single_file) + // Prepare handle + + handle = lr_handle_init(); +- fail_if(handle == NULL); ++ ck_assert_ptr_nonnull(handle); + + char *urls[] = {"http://www.google.com", NULL}; +- fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); ++ ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); +- fail_if(tmp_err); ++ ck_assert_ptr_null(tmp_err); + + + // Prepare list of download targets +@@ -57,20 +53,19 @@ START_TEST(test_downloader_single_file) + + fd1 = mkstemp(tmpfn1); + lr_free(tmpfn1); +- fail_if(fd1 < 0); ++ ck_assert_int_ge(fd1, 0); + + t1 = lr_downloadtarget_new(handle, "index.html", NULL, fd1, NULL, NULL, + 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, + FALSE, FALSE); +- fail_if(!t1); ++ ck_assert_ptr_nonnull(t1); + + list = g_slist_append(list, t1); + + // Download + +- ret = lr_download(list, FALSE, &err); +- fail_if(!ret); +- fail_if(err); ++ ck_assert(lr_download(list, FALSE, &err)); ++ ck_assert_ptr_null(err); + + lr_handle_free(handle); + +@@ -91,7 +86,6 @@ END_TEST + + START_TEST(test_downloader_single_file_2) + { +- int ret; + GSList *list = NULL; + GError *err = NULL; + int fd1; +@@ -104,20 +98,19 @@ START_TEST(test_downloader_single_file_2) + + fd1 = mkstemp(tmpfn1); + lr_free(tmpfn1); +- fail_if(fd1 < 0); ++ ck_assert_int_ge(fd1, 0); + + t1 = lr_downloadtarget_new(NULL, "http://seznam.cz/index.html", NULL, + fd1, NULL, NULL, 0, 0, NULL, NULL, NULL, + NULL, NULL, 0, 0, NULL, FALSE, FALSE); +- fail_if(!t1); ++ ck_assert_ptr_nonnull(t1); + + list = g_slist_append(list, t1); + + // Download + +- ret = lr_download(list, FALSE, &err); +- fail_if(!ret); +- fail_if(err); ++ ck_assert(lr_download(list, FALSE, &err)); ++ ck_assert_ptr_null(err); + + // Check results + +@@ -136,7 +129,6 @@ END_TEST + + START_TEST(test_downloader_two_files) + { +- int ret; + LrHandle *handle; + GSList *list = NULL; + GError *err = NULL; +@@ -148,12 +140,12 @@ START_TEST(test_downloader_two_files) + // Prepare handle + + handle = lr_handle_init(); +- fail_if(handle == NULL); ++ ck_assert_ptr_nonnull(handle); + + char *urls[] = {"http://www.google.com", NULL}; +- fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); ++ ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); +- fail_if(tmp_err); ++ ck_assert_ptr_null(tmp_err); + + // Prepare list of download targets + +@@ -164,26 +156,25 @@ START_TEST(test_downloader_two_files) + fd2 = mkstemp(tmpfn2); + lr_free(tmpfn1); + lr_free(tmpfn2); +- fail_if(fd1 < 0); +- fail_if(fd2 < 0); ++ ck_assert_int_ge(fd1, 0); ++ ck_assert_int_ge(fd2, 0); + + t1 = lr_downloadtarget_new(handle, "index.html", NULL, fd1, NULL, + NULL, 0, 0, NULL, NULL, NULL, + NULL, NULL, 0, 0, NULL, FALSE, FALSE); +- fail_if(!t1); ++ ck_assert_ptr_nonnull(t1); + t2 = lr_downloadtarget_new(handle, "index.html", "http://seznam.cz", fd2, + NULL, NULL, 0, 0, NULL, NULL, NULL, + NULL, NULL, 0, 0, NULL, FALSE, FALSE); +- fail_if(!t2); ++ ck_assert_ptr_nonnull(t2); + + list = g_slist_append(list, t1); + list = g_slist_append(list, t2); + + // Download + +- ret = lr_download(list, FALSE, &err); +- fail_if(!ret); +- fail_if(err); ++ ck_assert(lr_download(list, FALSE, &err)); ++ ck_assert_ptr_null(err); + + lr_handle_free(handle); + +@@ -205,7 +196,6 @@ END_TEST + + START_TEST(test_downloader_three_files_with_error) + { +- int ret; + LrHandle *handle; + GSList *list = NULL; + GError *err = NULL; +@@ -217,12 +207,12 @@ START_TEST(test_downloader_three_files_with_error) + // Prepare handle + + handle = lr_handle_init(); +- fail_if(handle == NULL); ++ ck_assert_ptr_nonnull(handle); + + char *urls[] = {"http://www.google.com", NULL}; +- fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); ++ ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); +- fail_if(tmp_err); ++ ck_assert_ptr_null(tmp_err); + + // Prepare list of download targets + +@@ -236,25 +226,25 @@ START_TEST(test_downloader_three_files_with_error) + lr_free(tmpfn1); + lr_free(tmpfn2); + lr_free(tmpfn3); +- fail_if(fd1 < 0); +- fail_if(fd2 < 0); +- fail_if(fd3 < 0); ++ ck_assert_int_ge(fd1, 0); ++ ck_assert_int_ge(fd2, 0); ++ ck_assert_int_ge(fd3, 0); + + t1 = lr_downloadtarget_new(handle, "index.html", NULL, fd1, NULL, NULL, + 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, + FALSE, FALSE); +- fail_if(!t1); ++ ck_assert_ptr_nonnull(t1); + + t2 = lr_downloadtarget_new(handle, "index.html", "http://seznam.cz", fd2, + NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, + NULL, 0, 0, NULL, FALSE, FALSE); +- fail_if(!t2); ++ ck_assert_ptr_nonnull(t2); + + t3 = lr_downloadtarget_new(handle, "i_hope_this_page_doesnt_exists.html", + "http://google.com", fd3, NULL, NULL, + 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, + FALSE, FALSE); +- fail_if(!t3); ++ ck_assert_ptr_nonnull(t3); + + list = g_slist_append(list, t1); + list = g_slist_append(list, t2); +@@ -262,9 +252,8 @@ START_TEST(test_downloader_three_files_with_error) + + // Download + +- ret = lr_download(list, FALSE, &err); +- fail_if(!ret); +- fail_if(err); ++ ck_assert(lr_download(list, FALSE, &err)); ++ ck_assert_ptr_null(err); + + lr_handle_free(handle); + +@@ -314,7 +303,6 @@ START_TEST(test_downloader_checksum) + int i; + + for (i = 0; tests[i].sha512; i++) { +- int ret; + LrHandle *handle; + GSList *list = NULL; + GError *err = NULL; +@@ -328,12 +316,12 @@ START_TEST(test_downloader_checksum) + // Prepare handle + + handle = lr_handle_init(); +- fail_if(handle == NULL); ++ ck_assert_ptr_nonnull(handle); + + char *urls[] = {"file:///", NULL}; +- fail_if(!lr_handle_setopt(handle, NULL, LRO_URLS, urls)); ++ ck_assert(lr_handle_setopt(handle, NULL, LRO_URLS, urls)); + lr_handle_prepare_internal_mirrorlist(handle, FALSE, &tmp_err); +- fail_if(tmp_err); ++ ck_assert_ptr_null(tmp_err); + + + // Prepare list of download targets +@@ -342,7 +330,7 @@ START_TEST(test_downloader_checksum) + + fd1 = mkstemp(tmpfn1); + lr_free(tmpfn1); +- fail_if(fd1 < 0); ++ ck_assert_int_ge(fd1, 0); + + checksum = lr_downloadtargetchecksum_new(LR_CHECKSUM_SHA512, + tests[i].sha512); +@@ -351,15 +339,14 @@ START_TEST(test_downloader_checksum) + t1 = lr_downloadtarget_new(handle, "dev/null", NULL, fd1, NULL, checksums, + 0, 0, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, + FALSE, FALSE); +- fail_if(!t1); ++ ck_assert_ptr_nonnull(t1); + + list = g_slist_append(list, t1); + + // Download + +- ret = lr_download(list, FALSE, &err); +- fail_if(!ret); +- fail_if(err); ++ ck_assert(lr_download(list, FALSE, &err)); ++ ck_assert_ptr_null(err); + + lr_handle_free(handle); + +diff --git a/tests/test_gpg.c b/tests/test_gpg.c +index 1f956d8b..fd322e38 100644 +--- a/tests/test_gpg.c ++++ b/tests/test_gpg.c +@@ -39,24 +39,24 @@ START_TEST(test_gpg_check_signature) + "repo_yum_01/repodata/repomd.xml_bad.asc", NULL); + + ret = lr_gpg_import_key(key_path, tmp_home_path, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + + // Valid key and data + ret = lr_gpg_check_signature(signature_path, + data_path, + tmp_home_path, + &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + + // Bad signature signed with unknown key + ret = lr_gpg_check_signature(_signature_path, + data_path, + tmp_home_path, + &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + tmp_err = NULL; + +@@ -65,31 +65,31 @@ START_TEST(test_gpg_check_signature) + _data_path, + tmp_home_path, + &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + tmp_err = NULL; + + // Import the 2nd key + ret = lr_gpg_import_key(_key_path, tmp_home_path, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + + // Valid key and data + ret = lr_gpg_check_signature(_signature_path, + _data_path, + tmp_home_path, + &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + + // Bad signature signed with known key + ret = lr_gpg_check_signature(_signature_path, + data_path, + tmp_home_path, + &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + tmp_err = NULL; + +@@ -98,8 +98,8 @@ START_TEST(test_gpg_check_signature) + data_path, + tmp_home_path, + &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + tmp_err = NULL; + +diff --git a/tests/test_handle.c b/tests/test_handle.c +index d8b3c3fe..a80df4eb 100644 +--- a/tests/test_handle.c ++++ b/tests/test_handle.c +@@ -22,42 +22,42 @@ START_TEST(test_handle) + GError *tmp_err = NULL; + + h = lr_handle_init(); +- fail_if(h == NULL); ++ ck_assert_ptr_nonnull(h); + lr_handle_free(h); + h = NULL; + + /* This test is meant to check memory leaks. (Use valgrind) */ + h = lr_handle_init(); + char *urls[] = {"foo", NULL}; +- fail_if(!lr_handle_setopt(h, &tmp_err, LRO_URLS, urls)); +- fail_if(tmp_err); +- fail_if(!lr_handle_setopt(h, &tmp_err, LRO_URLS, urls)); +- fail_if(tmp_err); +- fail_if(!lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "foo")); +- fail_if(tmp_err); +- fail_if(!lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "bar")); +- fail_if(tmp_err); +- fail_if(!lr_handle_setopt(h, NULL, LRO_USERPWD, "user:pwd")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY, "proxy")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_PROXYUSERPWD, "proxyuser:pwd")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_DESTDIR, "foodir")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_USERAGENT, "librepo/0.0")); ++ ck_assert(lr_handle_setopt(h, &tmp_err, LRO_URLS, urls)); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(lr_handle_setopt(h, &tmp_err, LRO_URLS, urls)); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "foo")); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(lr_handle_setopt(h, &tmp_err, LRO_MIRRORLIST, "bar")); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_USERPWD, "user:pwd")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY, "proxy")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_PROXYUSERPWD, "proxyuser:pwd")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_DESTDIR, "foodir")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_USERAGENT, "librepo/0.0")); + char *dlist[] = {"primary", "filelists", NULL}; +- fail_if(!lr_handle_setopt(h, NULL, LRO_YUMDLIST, dlist)); +- fail_if(!lr_handle_setopt(h, NULL, LRO_YUMBLIST, dlist)); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_YUMDLIST, dlist)); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_YUMBLIST, dlist)); + LrUrlVars *vars = NULL; + vars = lr_urlvars_set(vars, "foo", "bar"); +- fail_if(!lr_handle_setopt(h, NULL, LRO_VARSUB, vars)); +- fail_if(!lr_handle_setopt(h, NULL, LRO_FASTESTMIRRORCACHE, ++ ck_assert(lr_handle_setopt(h, NULL, LRO_VARSUB, vars)); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_FASTESTMIRRORCACHE, + "/var/cache/fastestmirror.librepo")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_SSLCLIENTCERT, "/etc/cert.pem")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_SSLCLIENTKEY, "/etc/cert.key")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_SSLCACERT, "/etc/ca.pem")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTCERT, "/etc/proxy_cert.pem")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTKEY, "/etc/proxy_cert.key")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_PROXY_SSLCACERT, "/etc/proxy_ca.pem")); +- fail_if(!lr_handle_setopt(h, NULL, LRO_HTTPAUTHMETHODS, LR_AUTH_NTLM)); +- fail_if(!lr_handle_setopt(h, NULL, LRO_PROXYAUTHMETHODS, LR_AUTH_DIGEST)); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_SSLCLIENTCERT, "/etc/cert.pem")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_SSLCLIENTKEY, "/etc/cert.key")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_SSLCACERT, "/etc/ca.pem")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTCERT, "/etc/proxy_cert.pem")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY_SSLCLIENTKEY, "/etc/proxy_cert.key")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_PROXY_SSLCACERT, "/etc/proxy_ca.pem")); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_HTTPAUTHMETHODS, LR_AUTH_NTLM)); ++ ck_assert(lr_handle_setopt(h, NULL, LRO_PROXYAUTHMETHODS, LR_AUTH_DIGEST)); + lr_handle_free(h); + } + END_TEST +@@ -73,90 +73,90 @@ START_TEST(test_handle_getinfo) + h = lr_handle_init(); + + num = -1; +- fail_if(!lr_handle_getinfo(h, &tmp_err, LRI_UPDATE, &num)); +- fail_if(num != 0); +- fail_if(tmp_err); ++ ck_assert(lr_handle_getinfo(h, &tmp_err, LRI_UPDATE, &num)); ++ ck_assert(num == 0); ++ ck_assert_ptr_null(tmp_err); + + strlist = NULL; +- fail_if(!lr_handle_getinfo(h, &tmp_err, LRI_URLS, &strlist)); +- fail_if(strlist != NULL); +- fail_if(tmp_err); ++ ck_assert(lr_handle_getinfo(h, &tmp_err, LRI_URLS, &strlist)); ++ ck_assert_ptr_null(strlist); ++ ck_assert_ptr_null(tmp_err); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_MIRRORLIST, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_MIRRORLIST, &str)); ++ ck_assert_ptr_null(str); + + num = -1; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_LOCAL, &num)); +- fail_if(num != 0); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_LOCAL, &num)); ++ ck_assert(num == 0); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_DESTDIR, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_DESTDIR, &str)); ++ ck_assert_ptr_null(str); + + num = -1; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_REPOTYPE, &num)); +- fail_if(num != 0); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_REPOTYPE, &num)); ++ ck_assert(num == 0); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_USERAGENT, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_USERAGENT, &str)); ++ ck_assert_ptr_null(str); + + strlist = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_YUMDLIST, &strlist)); +- fail_if(strlist != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_YUMDLIST, &strlist)); ++ ck_assert_ptr_null(strlist); + + strlist = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_YUMBLIST, &strlist)); +- fail_if(strlist != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_YUMBLIST, &strlist)); ++ ck_assert_ptr_null(strlist); + + num = -1; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_MAXMIRRORTRIES, &num)); +- fail_if(num != 0); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_MAXMIRRORTRIES, &num)); ++ ck_assert(num == 0); + + LrUrlVars *vars = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_VARSUB, &vars)); +- fail_if(strlist != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_VARSUB, &vars)); ++ ck_assert_ptr_null(strlist); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORCACHE, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORCACHE, &str)); ++ ck_assert_ptr_null(str); + + num = -1; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORMAXAGE, &num)); +- fail_if(num != LRO_FASTESTMIRRORMAXAGE_DEFAULT); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_FASTESTMIRRORMAXAGE, &num)); ++ ck_assert(num == LRO_FASTESTMIRRORMAXAGE_DEFAULT); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_SSLCLIENTCERT, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_SSLCLIENTCERT, &str)); ++ ck_assert_ptr_null(str); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_SSLCLIENTKEY, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_SSLCLIENTKEY, &str)); ++ ck_assert_ptr_null(str); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_SSLCACERT, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_SSLCACERT, &str)); ++ ck_assert_ptr_null(str); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTCERT, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTCERT, &str)); ++ ck_assert_ptr_null(str); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTKEY, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCLIENTKEY, &str)); ++ ck_assert_ptr_null(str); + + str = NULL; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCACERT, &str)); +- fail_if(str != NULL); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXY_SSLCACERT, &str)); ++ ck_assert_ptr_null(str); + + LrAuth auth = LR_AUTH_NONE; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_HTTPAUTHMETHODS, &auth)); +- fail_if(auth != LR_AUTH_BASIC); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_HTTPAUTHMETHODS, &auth)); ++ ck_assert(auth == LR_AUTH_BASIC); + + auth = LR_AUTH_NONE; +- fail_if(!lr_handle_getinfo(h, NULL, LRI_PROXYAUTHMETHODS, &auth)); +- fail_if(auth != LR_AUTH_BASIC); ++ ck_assert(lr_handle_getinfo(h, NULL, LRI_PROXYAUTHMETHODS, &auth)); ++ ck_assert(auth == LR_AUTH_BASIC); + + lr_handle_free(h); + } +diff --git a/tests/test_lrmirrorlist.c b/tests/test_lrmirrorlist.c +index 9c908026..70c73b2c 100644 +--- a/tests/test_lrmirrorlist.c ++++ b/tests/test_lrmirrorlist.c +@@ -29,16 +29,16 @@ START_TEST(test_lrmirrorlist_append_url) + lr_urlvars_free(vars); + + mirror = lr_lrmirrorlist_nth(iml, 0); +- fail_if(!mirror); +- fail_if(strcmp(mirror->url, "ftp://bar")); ++ ck_assert_ptr_nonnull(mirror); ++ ck_assert_str_eq(mirror->url, "ftp://bar"); + + mirror = lr_lrmirrorlist_nth(iml, 1); +- fail_if(!mirror); +- fail_if(strcmp(mirror->url, "http://foo")); ++ ck_assert_ptr_nonnull(mirror); ++ ck_assert_str_eq(mirror->url, "http://foo"); + + mirror = lr_lrmirrorlist_nth(iml, 2); +- fail_if(!mirror); +- fail_if(strcmp(mirror->url, "http://xyz/i386/")); ++ ck_assert_ptr_nonnull(mirror); ++ ck_assert_str_eq(mirror->url, "http://xyz/i386/"); + + lr_lrmirrorlist_free(iml); + } +@@ -56,30 +56,30 @@ START_TEST(test_lrmirrorlist_append_mirrorlist) + ml.urls = g_slist_prepend(ml.urls, "ftp://bar"); + ml.urls = g_slist_prepend(ml.urls, "http://foo"); + +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + iml = lr_lrmirrorlist_append_mirrorlist(iml, NULL, NULL); +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + + iml = lr_lrmirrorlist_append_mirrorlist(iml, &ml, NULL); +- fail_if(g_slist_length(iml) != 2); ++ ck_assert(g_slist_length(iml) == 2); + mirror = lr_lrmirrorlist_nth(iml, 0); +- fail_if(!mirror); +- fail_if(strcmp(mirror->url, "http://foo")); +- fail_if(mirror->preference != 100); +- fail_if(mirror->protocol != LR_PROTOCOL_HTTP); ++ ck_assert_ptr_nonnull(mirror); ++ ck_assert_str_eq(mirror->url, "http://foo"); ++ ck_assert(mirror->preference == 100); ++ ck_assert(mirror->protocol == LR_PROTOCOL_HTTP); + mirror = lr_lrmirrorlist_nth(iml, 1); +- fail_if(!mirror); +- fail_if(strcmp(mirror->url, "ftp://bar")); +- fail_if(mirror->preference != 100); +- fail_if(mirror->protocol != LR_PROTOCOL_FTP); ++ ck_assert_ptr_nonnull(mirror); ++ ck_assert_str_eq(mirror->url, "ftp://bar"); ++ ck_assert(mirror->preference == 100); ++ ck_assert(mirror->protocol == LR_PROTOCOL_FTP); + +- fail_if(g_slist_length(iml) != 2); ++ ck_assert(g_slist_length(iml) == 2); + + url = lr_lrmirrorlist_nth_url(iml, 0); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + + url = lr_lrmirrorlist_nth_url(iml, 1); +- fail_if(strcmp(url, "ftp://bar")); ++ ck_assert_str_eq(url, "ftp://bar"); + + lr_lrmirrorlist_free(iml); + g_slist_free(ml.urls); +@@ -132,46 +132,46 @@ START_TEST(test_lrmirrorlist_append_metalink) + ml.urls = g_slist_prepend(ml.urls, &url2); + ml.urls = g_slist_prepend(ml.urls, &url1); + +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + iml = lr_lrmirrorlist_append_metalink(iml, NULL, NULL, NULL); +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + + iml = lr_lrmirrorlist_append_metalink(iml, &ml, "/repodata/repomd.xml", NULL); +- fail_if(g_slist_length(iml) != 2); // 2 because element with empty url shoud be skipped ++ ck_assert(g_slist_length(iml) == 2); // 2 because element with empty url shoud be skipped + + mirror = lr_lrmirrorlist_nth(iml, 0); +- fail_if(strcmp(mirror->url, "http://foo")); +- fail_if(mirror->preference != 100); +- fail_if(mirror->protocol != LR_PROTOCOL_HTTP); ++ ck_assert_str_eq(mirror->url, "http://foo"); ++ ck_assert(mirror->preference == 100); ++ ck_assert(mirror->protocol == LR_PROTOCOL_HTTP); + + mirror = lr_lrmirrorlist_nth(iml, 1); +- fail_if(strcmp(mirror->url, "ftp://bar")); +- fail_if(mirror->preference != 95); +- fail_if(mirror->protocol != LR_PROTOCOL_FTP); ++ ck_assert_str_eq(mirror->url, "ftp://bar"); ++ ck_assert(mirror->preference == 95); ++ ck_assert(mirror->protocol == LR_PROTOCOL_FTP); + +- fail_if(g_slist_length(iml) != 2); ++ ck_assert(g_slist_length(iml) == 2); + + url = lr_lrmirrorlist_nth_url(iml, 0); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + + url = lr_lrmirrorlist_nth_url(iml, 1); +- fail_if(strcmp(url, "ftp://bar")); ++ ck_assert_str_eq(url, "ftp://bar"); + + lr_lrmirrorlist_free(iml); + + // Try append on list with existing element + iml = NULL; +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + iml = lr_lrmirrorlist_append_url(iml, "http://abc", NULL); +- fail_if(g_slist_length(iml) != 1); ++ ck_assert(g_slist_length(iml) == 1); + iml = lr_lrmirrorlist_append_metalink(iml, &ml, "/repodata/repomd.xml", NULL); +- fail_if(g_slist_length(iml) != 3); ++ ck_assert(g_slist_length(iml) == 3); + url = lr_lrmirrorlist_nth_url(iml, 0); +- fail_if(strcmp(url, "http://abc")); ++ ck_assert_str_eq(url, "http://abc"); + url = lr_lrmirrorlist_nth_url(iml, 1); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + url = lr_lrmirrorlist_nth_url(iml, 2); +- fail_if(strcmp(url, "ftp://bar")); ++ ck_assert_str_eq(url, "ftp://bar"); + + lr_lrmirrorlist_free(iml); + g_slist_free(ml.urls); +@@ -189,48 +189,48 @@ START_TEST(test_lrmirrorlist_append_lrmirrorlist) + iml_2 = lr_lrmirrorlist_append_url(iml_2, NULL, NULL); + iml_2 = lr_lrmirrorlist_append_url(iml_2, "ftp://bar", NULL); + +- fail_if(g_slist_length(iml_2) != 2); ++ ck_assert(g_slist_length(iml_2) == 2); + +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + iml = lr_lrmirrorlist_append_lrmirrorlist(iml, NULL); +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + + iml = lr_lrmirrorlist_append_lrmirrorlist(iml, iml_2); +- fail_if(g_slist_length(iml) != 2); // 2 because element with empty url shoud be skipped ++ ck_assert(g_slist_length(iml) == 2); // 2 because element with empty url shoud be skipped + + mirror = lr_lrmirrorlist_nth(iml, 0); +- fail_if(strcmp(mirror->url, "http://foo")); +- fail_if(mirror->preference != 100); +- fail_if(mirror->protocol != LR_PROTOCOL_HTTP); ++ ck_assert_str_eq(mirror->url, "http://foo"); ++ ck_assert(mirror->preference == 100); ++ ck_assert(mirror->protocol == LR_PROTOCOL_HTTP); + + mirror = lr_lrmirrorlist_nth(iml, 1); +- fail_if(strcmp(mirror->url, "ftp://bar")); +- fail_if(mirror->preference != 100); +- fail_if(mirror->protocol != LR_PROTOCOL_FTP); ++ ck_assert_str_eq(mirror->url, "ftp://bar"); ++ ck_assert(mirror->preference == 100); ++ ck_assert(mirror->protocol == LR_PROTOCOL_FTP); + +- fail_if(g_slist_length(iml) != 2); ++ ck_assert(g_slist_length(iml) == 2); + + url = lr_lrmirrorlist_nth_url(iml, 0); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + + url = lr_lrmirrorlist_nth_url(iml, 1); +- fail_if(strcmp(url, "ftp://bar")); ++ ck_assert_str_eq(url, "ftp://bar"); + + lr_lrmirrorlist_free(iml); + + // Try append on list with existing element + iml = NULL; +- fail_if(g_slist_length(iml) != 0); ++ ck_assert(g_slist_length(iml) == 0); + iml = lr_lrmirrorlist_append_url(iml, "http://abc", NULL); +- fail_if(g_slist_length(iml) != 1); ++ ck_assert(g_slist_length(iml) == 1); + iml = lr_lrmirrorlist_append_lrmirrorlist(iml, iml_2); +- fail_if(g_slist_length(iml) != 3); ++ ck_assert(g_slist_length(iml) == 3); + url = lr_lrmirrorlist_nth_url(iml, 0); +- fail_if(strcmp(url, "http://abc")); ++ ck_assert_str_eq(url, "http://abc"); + url = lr_lrmirrorlist_nth_url(iml, 1); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + url = lr_lrmirrorlist_nth_url(iml, 2); +- fail_if(strcmp(url, "ftp://bar")); ++ ck_assert_str_eq(url, "ftp://bar"); + lr_lrmirrorlist_free(iml); + lr_lrmirrorlist_free(iml_2); + } +diff --git a/tests/test_metalink.c b/tests/test_metalink.c +index 69ebc236..e425742c 100644 +--- a/tests/test_metalink.c ++++ b/tests/test_metalink.c +@@ -29,7 +29,7 @@ START_TEST(test_metalink_init) + LrMetalink *ml = NULL; + + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + lr_metalink_free(ml); + } + END_TEST +@@ -49,101 +49,101 @@ START_TEST(test_metalink_good_01) + "metalink_good_01", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + close(fd); + +- fail_if(ml->filename == NULL); +- fail_if(strcmp(ml->filename, "repomd.xml")); +- fail_if(ml->timestamp != 1337942396); +- fail_if(ml->size != 4309); +- fail_if(g_slist_length(ml->hashes) != 4); +- fail_if(g_slist_length(ml->urls) != 106); ++ ck_assert_ptr_nonnull(ml->filename); ++ ck_assert_str_eq(ml->filename, "repomd.xml"); ++ ck_assert(ml->timestamp == 1337942396); ++ ck_assert(ml->size == 4309); ++ ck_assert(g_slist_length(ml->hashes) == 4); ++ ck_assert(g_slist_length(ml->urls) == 106); + + elem = g_slist_nth(ml->hashes, 0); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "md5")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "20b6d77930574ae541108e8e7987ad3f")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "md5"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "20b6d77930574ae541108e8e7987ad3f"); + + elem = g_slist_nth(ml->hashes, 1); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "sha1")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "4a5ae1831a567b58e2e0f0de1529ca199d1d8319")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "sha1"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "4a5ae1831a567b58e2e0f0de1529ca199d1d8319"); + + elem = g_slist_nth(ml->hashes, 2); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "sha256")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "sha256"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf"); + + elem = g_slist_nth(ml->hashes, 3); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "sha512")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "sha512"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd"); + + elem = g_slist_nth(ml->urls, 0); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol == NULL); +- fail_if(strcmp(mlurl->protocol, "http")); +- fail_if(mlurl->type == NULL); +- fail_if(strcmp(mlurl->type, "http")); +- fail_if(mlurl->location == NULL); +- fail_if(strcmp(mlurl->location, "US")); +- fail_if(mlurl->preference != 99); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_nonnull(mlurl->protocol); ++ ck_assert_str_eq(mlurl->protocol, "http"); ++ ck_assert_ptr_nonnull(mlurl->type); ++ ck_assert_str_eq(mlurl->type, "http"); ++ ck_assert_ptr_nonnull(mlurl->location); ++ ck_assert_str_eq(mlurl->location, "US"); ++ ck_assert(mlurl->preference == 99); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + elem = g_slist_nth(ml->urls, 2); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol == NULL); +- fail_if(strcmp(mlurl->protocol, "ftp")); +- fail_if(mlurl->type == NULL); +- fail_if(strcmp(mlurl->type, "ftp")); +- fail_if(mlurl->location == NULL); +- fail_if(strcmp(mlurl->location, "US")); +- fail_if(mlurl->preference != 98); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_nonnull(mlurl->protocol); ++ ck_assert_str_eq(mlurl->protocol, "ftp"); ++ ck_assert_ptr_nonnull(mlurl->type); ++ ck_assert_str_eq(mlurl->type, "ftp"); ++ ck_assert_ptr_nonnull(mlurl->location); ++ ck_assert_str_eq(mlurl->location, "US"); ++ ck_assert(mlurl->preference == 98); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + elem = g_slist_nth(ml->urls, 104); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol == NULL); +- fail_if(strcmp(mlurl->protocol, "rsync")); +- fail_if(mlurl->type == NULL); +- fail_if(strcmp(mlurl->type, "rsync")); +- fail_if(mlurl->location == NULL); +- fail_if(strcmp(mlurl->location, "CA")); +- fail_if(mlurl->preference != 48); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "rsync://mirror.csclub.uwaterloo.ca/fedora-enchilada/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_nonnull(mlurl->protocol); ++ ck_assert_str_eq(mlurl->protocol, "rsync"); ++ ck_assert_ptr_nonnull(mlurl->type); ++ ck_assert_str_eq(mlurl->type, "rsync"); ++ ck_assert_ptr_nonnull(mlurl->location); ++ ck_assert_str_eq(mlurl->location, "CA"); ++ ck_assert(mlurl->preference == 48); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "rsync://mirror.csclub.uwaterloo.ca/fedora-enchilada/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + lr_metalink_free(ml); + } +@@ -161,35 +161,35 @@ START_TEST(test_metalink_good_02) + "metalink_good_02", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + close(fd); + +- fail_if(ml->filename == NULL); +- fail_if(strcmp(ml->filename, "repomd.xml")); +- fail_if(ml->timestamp != 0); +- fail_if(ml->size != 0); +- fail_if(g_slist_length(ml->hashes) != 0); +- fail_if(g_slist_length(ml->urls) != 3); ++ ck_assert_ptr_nonnull(ml->filename); ++ ck_assert_str_eq(ml->filename, "repomd.xml"); ++ ck_assert(ml->timestamp == 0); ++ ck_assert(ml->size == 0); ++ ck_assert(g_slist_length(ml->hashes) == 0); ++ ck_assert(g_slist_length(ml->urls) == 3); + + GSList *list = g_slist_nth(ml->urls, 0); +- fail_if(!list); ++ ck_assert_ptr_nonnull(list); + LrMetalinkUrl *mlurl = list->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol == NULL); +- fail_if(strcmp(mlurl->protocol, "http")); +- fail_if(mlurl->type == NULL); +- fail_if(strcmp(mlurl->type, "http")); +- fail_if(mlurl->location == NULL); +- fail_if(strcmp(mlurl->location, "US")); +- fail_if(mlurl->preference != 97); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_nonnull(mlurl->protocol); ++ ck_assert_str_eq(mlurl->protocol, "http"); ++ ck_assert_ptr_nonnull(mlurl->type); ++ ck_assert_str_eq(mlurl->type, "http"); ++ ck_assert_ptr_nonnull(mlurl->location); ++ ck_assert_str_eq(mlurl->location, "US"); ++ ck_assert(mlurl->preference == 97); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + lr_metalink_free(ml); + } +@@ -207,20 +207,20 @@ START_TEST(test_metalink_good_03) + "metalink_good_03", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + close(fd); + +- fail_if(ml->filename == NULL); +- fail_if(strcmp(ml->filename, "repomd.xml")); +- fail_if(ml->timestamp != 0); +- fail_if(ml->size != 0); +- fail_if(g_slist_length(ml->hashes) != 0); +- fail_if(g_slist_length(ml->urls) != 0); ++ ck_assert_ptr_nonnull(ml->filename); ++ ck_assert_str_eq(ml->filename, "repomd.xml"); ++ ck_assert(ml->timestamp == 0); ++ ck_assert(ml->size == 0); ++ ck_assert(g_slist_length(ml->hashes) == 0); ++ ck_assert(g_slist_length(ml->urls) == 0); + + lr_metalink_free(ml); + } +@@ -251,112 +251,110 @@ START_TEST(test_metalink_bad_01) + "metalink_bad_01", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + int call_counter = 0; + ret = lr_metalink_parse_file(ml, fd, REPOMD, warning_cb, &call_counter, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); +- fail_if(call_counter <= 0); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert_int_gt(call_counter, 0); + close(fd); + +- fail_if(ml->filename == NULL); +- fail_if(strcmp(ml->filename, "repomd.xml")); +- fail_if(ml->timestamp != 0); +- fail_if(ml->size != 0); +- fail_if(g_slist_length(ml->hashes) != 4); +- fail_if(g_slist_length(ml->urls) != 4); +- fail_if(g_slist_length(ml->alternates) != 0); ++ ck_assert_ptr_nonnull(ml->filename); ++ ck_assert_str_eq(ml->filename, "repomd.xml"); ++ ck_assert(ml->timestamp == 0); ++ ck_assert(ml->size == 0); ++ ck_assert(g_slist_length(ml->hashes) == 4); ++ ck_assert(g_slist_length(ml->urls) == 4); ++ ck_assert(g_slist_length(ml->alternates) == 0); + + elem = g_slist_nth(ml->hashes, 0); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "md5")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, +- "20b6d77930574ae541108e8e7987ad3f")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "md5"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "20b6d77930574ae541108e8e7987ad3f"); + + elem = g_slist_nth(ml->hashes, 1); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "foo")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "foo"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, ""); + + elem = g_slist_nth(ml->hashes, 2); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "sha256")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, +- "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "sha256"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "0076c44aabd352da878d5c4d794901ac87f66afac869488f6a4ef166de018cdf"); + + elem = g_slist_nth(ml->hashes, 3); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "sha512")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, +- "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "sha512"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, ++ "884dc465da67fee8fe3f11dab321a99d9a13b22ce97f84ceff210e82b6b1a8c635ccd196add1dd738807686714c3a0a048897e2d0650bc05302b3ee26de521fd"); + + elem = g_slist_nth(ml->urls, 0); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol == NULL); +- fail_if(strcmp(mlurl->protocol, "http")); +- fail_if(mlurl->type == NULL); +- fail_if(strcmp(mlurl->type, "http")); +- fail_if(mlurl->location == NULL); +- fail_if(strcmp(mlurl->location, "US")); +- fail_if(mlurl->preference != 0); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_nonnull(mlurl->protocol); ++ ck_assert_str_eq(mlurl->protocol, "http"); ++ ck_assert_ptr_nonnull(mlurl->type); ++ ck_assert_str_eq(mlurl->type, "http"); ++ ck_assert_ptr_nonnull(mlurl->location); ++ ck_assert_str_eq(mlurl->location, "US"); ++ ck_assert(mlurl->preference == 0); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "http://mirror.pnl.gov/fedora/linux/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + elem = g_slist_nth(ml->urls, 1); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol != NULL); +- fail_if(mlurl->type != NULL); +- fail_if(mlurl->location != NULL); +- fail_if(mlurl->preference < 0 || mlurl->preference > 100); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_null(mlurl->protocol); ++ ck_assert_ptr_null(mlurl->type); ++ ck_assert_ptr_null(mlurl->location); ++ ck_assert(mlurl->preference >= 0 && mlurl->preference <= 100); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "ftp://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + elem = g_slist_nth(ml->urls, 2); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol != NULL); +- fail_if(mlurl->type != NULL); +- fail_if(mlurl->location != NULL); +- fail_if(mlurl->preference != 0); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, +- "rsync://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_null(mlurl->protocol); ++ ck_assert_ptr_null(mlurl->type); ++ ck_assert_ptr_null(mlurl->location); ++ ck_assert(mlurl->preference == 0); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ++ "rsync://mirrors.syringanetworks.net/fedora/releases/17/Everything/x86_64/os/repodata/repomd.xml"); + + elem = g_slist_nth(ml->urls, 3); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlurl = elem->data; +- fail_if(!mlurl); +- fail_if(mlurl->protocol != NULL); +- fail_if(mlurl->type != NULL); +- fail_if(mlurl->location != NULL); +- fail_if(mlurl->preference != 0); +- fail_if(mlurl->url == NULL); +- fail_if(strcmp(mlurl->url, "")); ++ ck_assert_ptr_nonnull(mlurl); ++ ck_assert_ptr_null(mlurl->protocol); ++ ck_assert_ptr_null(mlurl->type); ++ ck_assert_ptr_null(mlurl->location); ++ ck_assert(mlurl->preference == 0); ++ ck_assert_ptr_nonnull(mlurl->url); ++ ck_assert_str_eq(mlurl->url, ""); + + lr_metalink_free(ml); + } +@@ -374,14 +372,14 @@ START_TEST(test_metalink_bad_02) + "metalink_bad_02", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + close(fd); +- fail_if(g_slist_length(ml->urls) != 0); ++ ck_assert(g_slist_length(ml->urls) == 0); + lr_metalink_free(ml); + } + END_TEST +@@ -398,12 +396,12 @@ START_TEST(test_metalink_really_bad_01) + "metalink_really_bad_01", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + close(fd); + lr_metalink_free(ml); +@@ -422,12 +420,12 @@ START_TEST(test_metalink_really_bad_02) + "metalink_really_bad_02", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + close(fd); + lr_metalink_free(ml); +@@ -446,12 +444,12 @@ START_TEST(test_metalink_really_bad_03) + "metalink_really_bad_03", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(ret); +- fail_if(!tmp_err); ++ ck_assert(!ret); ++ ck_assert_ptr_nonnull(tmp_err); + g_error_free(tmp_err); + close(fd); + lr_metalink_free(ml); +@@ -473,41 +471,41 @@ START_TEST(test_metalink_with_alternates) + "metalink_with_alternates", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_metalink_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_metalink_parse_file(ml, fd, REPOMD, NULL, NULL, &tmp_err); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + close(fd); + +- fail_if(ml->filename == NULL); +- fail_if(strcmp(ml->filename, "repomd.xml")); +- fail_if(g_slist_length(ml->hashes) != 4); +- fail_if(g_slist_length(ml->alternates) != 1); ++ ck_assert_ptr_nonnull(ml->filename); ++ ck_assert_str_eq(ml->filename, "repomd.xml"); ++ ck_assert(g_slist_length(ml->hashes) == 4); ++ ck_assert(g_slist_length(ml->alternates) == 1); + + elem = g_slist_nth(ml->hashes, 0); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "md5")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "0ffcd7798421c9a6760f3e4202cc4675")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "md5"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "0ffcd7798421c9a6760f3e4202cc4675"); + + elem = g_slist_nth(ml->alternates, 0); +- fail_if(!elem); ++ ck_assert_ptr_nonnull(elem); + malternate = elem->data; +- fail_if(malternate->timestamp != 1381706941); +- fail_if(malternate->size != 4761); +- fail_if(g_slist_length(malternate->hashes) != 4); ++ ck_assert(malternate->timestamp == 1381706941); ++ ck_assert(malternate->size == 4761); ++ ck_assert(g_slist_length(malternate->hashes) == 4); + elem = g_slist_nth(malternate->hashes, 0); + mlhash = elem->data; +- fail_if(!mlhash); +- fail_if(mlhash->type == NULL); +- fail_if(strcmp(mlhash->type, "md5")); +- fail_if(mlhash->value == NULL); +- fail_if(strcmp(mlhash->value, "0c5b64d395d5364633df7c8e97a07fd6")); ++ ck_assert_ptr_nonnull(mlhash); ++ ck_assert_ptr_nonnull(mlhash->type); ++ ck_assert_str_eq(mlhash->type, "md5"); ++ ck_assert_ptr_nonnull(mlhash->value); ++ ck_assert_str_eq(mlhash->value, "0c5b64d395d5364633df7c8e97a07fd6"); + + lr_metalink_free(ml); + } +diff --git a/tests/test_mirrorlist.c b/tests/test_mirrorlist.c +index 6ccf2537..cc00b7fc 100644 +--- a/tests/test_mirrorlist.c ++++ b/tests/test_mirrorlist.c +@@ -18,7 +18,7 @@ START_TEST(test_mirrorlist_init) + LrMirrorlist *ml = NULL; + + ml = lr_mirrorlist_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + lr_mirrorlist_free(ml); + } + END_TEST +@@ -36,23 +36,23 @@ START_TEST(test_mirrorlist_01) + "mirrorlist_01", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_mirrorlist_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_mirrorlist_parse_file(ml, fd, &tmp_err); + close(fd); +- fail_if(!ret); +- fail_if(tmp_err); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); + +- fail_if(g_slist_length(ml->urls) != 2); ++ ck_assert(g_slist_length(ml->urls) == 2); + + elem = g_slist_nth(ml->urls, 0); +- fail_if(!elem); +- fail_if(g_strcmp0(elem->data, "http://foo.bar/fedora/linux/")); ++ ck_assert_ptr_nonnull(elem); ++ ck_assert_str_eq(elem->data, "http://foo.bar/fedora/linux/"); + + elem = g_slist_nth(ml->urls, 1); +- fail_if(!elem); +- fail_if(g_strcmp0(elem->data, "ftp://ftp.bar.foo/Fedora/17/")); ++ ck_assert_ptr_nonnull(elem); ++ ck_assert_str_eq(elem->data, "ftp://ftp.bar.foo/Fedora/17/"); + lr_mirrorlist_free(ml); + } + END_TEST +@@ -69,14 +69,14 @@ START_TEST(test_mirrorlist_02) + "mirrorlist_02", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_mirrorlist_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_mirrorlist_parse_file(ml, fd, &tmp_err); + close(fd); +- fail_if(!ret); +- fail_if(tmp_err); +- fail_if(g_slist_length(ml->urls) != 0); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(g_slist_length(ml->urls) == 0); + lr_mirrorlist_free(ml); + } + END_TEST +@@ -93,14 +93,14 @@ START_TEST(test_mirrorlist_03) + "mirrorlist_03", NULL); + fd = open(path, O_RDONLY); + lr_free(path); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + ml = lr_mirrorlist_init(); +- fail_if(ml == NULL); ++ ck_assert_ptr_nonnull(ml); + ret = lr_mirrorlist_parse_file(ml, fd, &tmp_err); + close(fd); +- fail_if(!ret); +- fail_if(tmp_err); +- fail_if(g_slist_length(ml->urls) != 0); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(g_slist_length(ml->urls) == 0); + lr_mirrorlist_free(ml); + } + END_TEST +diff --git a/tests/test_package_downloader.c b/tests/test_package_downloader.c +index b384bef8..3263ba02 100644 +--- a/tests/test_package_downloader.c ++++ b/tests/test_package_downloader.c +@@ -25,19 +25,19 @@ START_TEST(test_package_downloader_new_and_free) + + target = lr_packagetarget_new(NULL, "url", NULL, 0, NULL, 0, NULL, FALSE, + NULL, NULL, &err); +- fail_if(!target); +- fail_if(err); ++ ck_assert_ptr_nonnull(target); ++ ck_assert_ptr_null(err); + +- fail_if(strcmp(target->relative_url, "url")); +- fail_if(target->dest); +- fail_if(target->base_url); +- fail_if(target->checksum_type != 0); +- fail_if(target->checksum); +- fail_if(target->resume != FALSE); +- fail_if(target->progresscb); +- fail_if(target->cbdata); +- fail_if(target->local_path); +- fail_if(target->err); ++ ck_assert_str_eq(target->relative_url, "url"); ++ ck_assert_ptr_null(target->dest); ++ ck_assert_ptr_null(target->base_url); ++ ck_assert(target->checksum_type == 0); ++ ck_assert_ptr_null(target->checksum); ++ ck_assert(target->resume == FALSE); ++ ck_assert(!target->progresscb); ++ ck_assert_ptr_null(target->cbdata); ++ ck_assert_ptr_null(target->local_path); ++ ck_assert_ptr_null(target->err); + + lr_packagetarget_free(target); + target = NULL; +@@ -47,19 +47,19 @@ START_TEST(test_package_downloader_new_and_free) + target = lr_packagetarget_new(NULL, "url", "dest", LR_CHECKSUM_SHA384, + "xxx", 0, "baseurl", TRUE, (LrProgressCb) 22, + (void *) 33, &err); +- fail_if(!target); +- fail_if(err); ++ ck_assert_ptr_nonnull(target); ++ ck_assert_ptr_null(err); + +- fail_if(strcmp(target->relative_url, "url")); +- fail_if(strcmp(target->dest, "dest")); +- fail_if(strcmp(target->base_url, "baseurl")); +- fail_if(target->checksum_type != LR_CHECKSUM_SHA384); +- fail_if(strcmp(target->checksum, "xxx")); +- fail_if(target->resume != TRUE); +- fail_if(target->progresscb != (LrProgressCb) 22); +- fail_if(target->cbdata != (void *) 33); +- fail_if(target->local_path); +- fail_if(target->err); ++ ck_assert_str_eq(target->relative_url, "url"); ++ ck_assert_str_eq(target->dest, "dest"); ++ ck_assert_str_eq(target->base_url, "baseurl"); ++ ck_assert(target->checksum_type == LR_CHECKSUM_SHA384); ++ ck_assert_str_eq(target->checksum, "xxx"); ++ ck_assert(target->resume == TRUE); ++ ck_assert(target->progresscb == (LrProgressCb) 22); ++ ck_assert_ptr_eq(target->cbdata, (void *) 33); ++ ck_assert_ptr_null(target->local_path); ++ ck_assert_ptr_null(target->err); + + lr_packagetarget_free(target); + target = NULL; +diff --git a/tests/test_repo_zck.c b/tests/test_repo_zck.c +index a2299a8d..e68b1442 100644 +--- a/tests/test_repo_zck.c ++++ b/tests/test_repo_zck.c +@@ -23,22 +23,22 @@ START_TEST(test_repo_zck_parsing) + "repo_yum_03/repodata/repomd.xml", + NULL); + repomd = lr_yum_repomd_init(); +- fail_if(!repomd); ++ ck_assert_ptr_nonnull(repomd); + fd = open(repomd_path, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + + ret = lr_yum_repomd_parse_file(repomd, fd, NULL, NULL, &tmp_err); + close(fd); + +- fail_if(!ret); +- fail_if(tmp_err); +- fail_if(g_slist_length(repomd->records) != 12); +- fail_if(!lr_yum_repomd_get_record(repomd, "primary")); +- fail_if(!lr_yum_repomd_get_record(repomd, "filelists")); +- fail_if(!lr_yum_repomd_get_record(repomd, "other")); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(g_slist_length(repomd->records) == 12); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "primary")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "filelists")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "other")); + +- fail_if(lr_yum_repomd_get_record(repomd, "foo")); +- fail_if(lr_yum_repomd_get_record(repomd, "bar")); ++ ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "foo")); ++ ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "bar")); + + lr_yum_repomd_free(repomd); + lr_free(repomd_path); +diff --git a/tests/test_repoconf.c b/tests/test_repoconf.c +index 5c85047e..0036b500 100644 +--- a/tests/test_repoconf.c ++++ b/tests/test_repoconf.c +@@ -304,19 +304,19 @@ START_TEST(test_parse_repoconf_minimal) + path = lr_pathconcat(test_globals.testdata_dir, "repo-minimal.repo", NULL); + + confs = lr_yum_repoconfs_init(); +- fail_if(!confs); ++ ck_assert_ptr_nonnull(confs); + + ret = lr_yum_repoconfs_parse(confs, path, &tmp_err); +- fail_if(!ret); ++ ck_assert(ret); + + list = lr_yum_repoconfs_get_list(confs, &tmp_err); +- fail_if(!list); +- fail_if(g_slist_length(list) != 2); ++ ck_assert_ptr_nonnull(list); ++ ck_assert(g_slist_length(list) == 2); + + // Test content of first repo config + + conf = g_slist_nth_data(list, 0); +- fail_if(!conf); ++ ck_assert_ptr_nonnull(conf); + + conf_assert_str_eq(LR_YRC_ID, "minimal-repo-1"); + conf_assert_str_eq(LR_YRC_NAME, "Minimal repo 1 - $basearch"); +@@ -363,7 +363,7 @@ START_TEST(test_parse_repoconf_minimal) + // Test content of second repo config + + conf = g_slist_nth_data(list, 1); +- fail_if(!conf); ++ ck_assert_ptr_nonnull(conf); + + conf_assert_str_eq(LR_YRC_ID, "minimal-repo-2"); + conf_assert_str_eq(LR_YRC_NAME, "Minimal repo 2 - $basearch"); +@@ -423,17 +423,17 @@ START_TEST(test_parse_repoconf_big) + path = lr_pathconcat(test_globals.testdata_dir, "repo-big.repo", NULL); + + confs = lr_yum_repoconfs_init(); +- fail_if(!confs); ++ ck_assert_ptr_nonnull(confs); + + ret = lr_yum_repoconfs_parse(confs, path, &tmp_err); +- fail_if(!ret); ++ ck_assert(ret); + + list = lr_yum_repoconfs_get_list(confs, &tmp_err); +- fail_if(!list); +- fail_if(g_slist_length(list) != 1); ++ ck_assert_ptr_nonnull(list); ++ ck_assert(g_slist_length(list) == 1); + + conf = g_slist_nth_data(list, 0); +- fail_if(!conf); ++ ck_assert_ptr_nonnull(conf); + + conf_assert_str_eq(LR_YRC_ID, "big-repo"); + conf_assert_str_eq(LR_YRC_NAME, "Maxi repo - $basearch"); +@@ -504,7 +504,7 @@ START_TEST(test_write_repoconf) + + // Create a temporary file + fd = mkstemp(tmpfn); +- fail_if(fd == -1); ++ ck_assert_int_ne(fd, -1); + + // Create reconfs with one repoconf with one id (one section) + confs = lr_yum_repoconfs_init(); +diff --git a/tests/test_repomd.c b/tests/test_repomd.c +index 3dda8337..4c9300d6 100644 +--- a/tests/test_repomd.c ++++ b/tests/test_repomd.c +@@ -23,31 +23,31 @@ START_TEST(test_repomd_parsing) + "repo_yum_02/repodata/repomd.xml", + NULL); + repomd = lr_yum_repomd_init(); +- fail_if(!repomd); ++ ck_assert_ptr_nonnull(repomd); + fd = open(repomd_path, O_RDONLY); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + + ret = lr_yum_repomd_parse_file(repomd, fd, NULL, NULL, &tmp_err); + close(fd); + +- fail_if(!ret); +- fail_if(tmp_err); +- fail_if(g_slist_length(repomd->records) != 12); +- fail_if(!lr_yum_repomd_get_record(repomd, "primary")); +- fail_if(!lr_yum_repomd_get_record(repomd, "filelists")); +- fail_if(!lr_yum_repomd_get_record(repomd, "other")); +- fail_if(!lr_yum_repomd_get_record(repomd, "primary_db")); +- fail_if(!lr_yum_repomd_get_record(repomd, "filelists_db")); +- fail_if(!lr_yum_repomd_get_record(repomd, "other_db")); +- fail_if(!lr_yum_repomd_get_record(repomd, "group")); +- fail_if(!lr_yum_repomd_get_record(repomd, "group_gz")); +- fail_if(!lr_yum_repomd_get_record(repomd, "updateinfo")); +- fail_if(!lr_yum_repomd_get_record(repomd, "origin")); +- fail_if(!lr_yum_repomd_get_record(repomd, "prestodelta")); +- fail_if(!lr_yum_repomd_get_record(repomd, "deltainfo")); ++ ck_assert(ret); ++ ck_assert_ptr_null(tmp_err); ++ ck_assert(g_slist_length(repomd->records) == 12); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "primary")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "filelists")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "other")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "primary_db")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "filelists_db")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "other_db")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "group")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "group_gz")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "updateinfo")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "origin")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "prestodelta")); ++ ck_assert_ptr_nonnull(lr_yum_repomd_get_record(repomd, "deltainfo")); + +- fail_if(lr_yum_repomd_get_record(repomd, "foo")); +- fail_if(lr_yum_repomd_get_record(repomd, "bar")); ++ ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "foo")); ++ ck_assert_ptr_null(lr_yum_repomd_get_record(repomd, "bar")); + + lr_yum_repomd_free(repomd); + lr_free(repomd_path); +diff --git a/tests/test_url_substitution.c b/tests/test_url_substitution.c +index e3d53a79..b0086a8c 100644 +--- a/tests/test_url_substitution.c ++++ b/tests/test_url_substitution.c +@@ -20,22 +20,22 @@ START_TEST(test_urlvars_set) + LrUrlVars *urlvars = NULL; + + urlvars = lr_urlvars_set(urlvars, "foo", "bar"); +- fail_if(urlvars == NULL); +- fail_if(strcmp(((LrVar *)urlvars->data)->var, "foo") != 0); ++ ck_assert_ptr_nonnull(urlvars); ++ ck_assert_str_eq(((LrVar *)urlvars->data)->var, "foo"); + + urlvars = lr_urlvars_set(urlvars, "foo1", "bar1"); +- fail_if(urlvars == NULL); ++ ck_assert_ptr_nonnull(urlvars); + + urlvars = lr_urlvars_set(urlvars, "foo", NULL); +- fail_if(urlvars == NULL); +- fail_if(strcmp(((LrVar *)urlvars->data)->var, "foo1") != 0); ++ ck_assert_ptr_nonnull(urlvars); ++ ck_assert_str_eq(((LrVar *)urlvars->data)->var, "foo1"); + + urlvars = lr_urlvars_set(urlvars, "foo1", NULL); +- fail_if(urlvars != NULL); ++ ck_assert_ptr_null(urlvars); + + urlvars = lr_urlvars_set(urlvars, "bar", "foo"); +- fail_if(urlvars == NULL); +- fail_if(strcmp(((LrVar *)urlvars->data)->var, "bar") != 0); ++ ck_assert_ptr_nonnull(urlvars); ++ ck_assert_str_eq(((LrVar *)urlvars->data)->var, "bar"); + + lr_urlvars_free(urlvars); + } +@@ -49,19 +49,19 @@ START_TEST(test_url_substitute_without_urlvars) + urlvars = lr_urlvars_set(urlvars, "foo", "bar"); + + url = lr_url_substitute("", urlvars); +- fail_if(strcmp(url, "")); ++ ck_assert_str_eq(url, ""); + lr_free(url); + + url = lr_url_substitute("http://foo", urlvars); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + lr_free(url); + + url = lr_url_substitute("http://foo?id=$bar", urlvars); +- fail_if(strcmp(url, "http://foo?id=$bar")); ++ ck_assert_str_eq(url, "http://foo?id=$bar"); + lr_free(url); + + url = lr_url_substitute("http://foo?id=$foox", urlvars); +- fail_if(strcmp(url, "http://foo?id=$foox")); ++ ck_assert_str_eq(url, "http://foo?id=$foox"); + lr_free(url); + + lr_urlvars_free(urlvars); +@@ -78,31 +78,31 @@ START_TEST(test_url_substitute) + urlvars = lr_urlvars_set(urlvars, "bar", "repo"); + + url = lr_url_substitute("", urlvars); +- fail_if(strcmp(url, "")); ++ ck_assert_str_eq(url, ""); + lr_free(url); + + url = lr_url_substitute("http://foo", urlvars); +- fail_if(strcmp(url, "http://foo")); ++ ck_assert_str_eq(url, "http://foo"); + lr_free(url); + + url = lr_url_substitute("http://foo?id=$bar", urlvars); +- fail_if(strcmp(url, "http://foo?id=repo")); ++ ck_assert_str_eq(url, "http://foo?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://$foo?id=$bar", urlvars); +- fail_if(strcmp(url, "http://version?id=repo")); ++ ck_assert_str_eq(url, "http://version?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://$fo?id=$bar", urlvars); +- fail_if(strcmp(url, "http://ver?id=repo")); ++ ck_assert_str_eq(url, "http://ver?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://$foo$bar", urlvars); +- fail_if(strcmp(url, "http://versionrepo")); ++ ck_assert_str_eq(url, "http://versionrepo"); + lr_free(url); + + url = lr_url_substitute("http://$foo$bar/", urlvars); +- fail_if(strcmp(url, "http://versionrepo/")); ++ ck_assert_str_eq(url, "http://versionrepo/"); + lr_free(url); + + lr_urlvars_free(urlvars); +@@ -119,27 +119,27 @@ START_TEST(test_url_substitute_braces) + urlvars = lr_urlvars_set(urlvars, "bar", "repo"); + + url = lr_url_substitute("http://foo?id=${bar}", urlvars); +- fail_if(strcmp(url, "http://foo?id=repo")); ++ ck_assert_str_eq(url, "http://foo?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://${foo}?id=${bar}", urlvars); +- fail_if(strcmp(url, "http://version?id=repo")); ++ ck_assert_str_eq(url, "http://version?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://${fo}?id=$bar", urlvars); +- fail_if(strcmp(url, "http://ver?id=repo")); ++ ck_assert_str_eq(url, "http://ver?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://${fo?id=$bar", urlvars); +- fail_if(strcmp(url, "http://${fo?id=repo")); ++ ck_assert_str_eq(url, "http://${fo?id=repo"); + lr_free(url); + + url = lr_url_substitute("http://${foo${bar}", urlvars); +- fail_if(strcmp(url, "http://${foorepo")); ++ ck_assert_str_eq(url, "http://${foorepo"); + lr_free(url); + + url = lr_url_substitute("http://${foo}${bar}/", urlvars); +- fail_if(strcmp(url, "http://versionrepo/")); ++ ck_assert_str_eq(url, "http://versionrepo/"); + lr_free(url); + + lr_urlvars_free(urlvars); +diff --git a/tests/test_util.c b/tests/test_util.c +index b3b2b6dd..595b0fef 100644 +--- a/tests/test_util.c ++++ b/tests/test_util.c +@@ -18,7 +18,7 @@ START_TEST(test_malloc) + { + long long *num = NULL; + num = lr_malloc0(sizeof(long long)); +- fail_if(num == NULL); ++ ck_assert_ptr_nonnull(num); + lr_free(num); + } + END_TEST +@@ -27,8 +27,8 @@ START_TEST(test_malloc0) + { + long long *num = NULL; + num = lr_malloc0(sizeof(long long)); +- fail_if(num == NULL); +- fail_if(*num != 0LL); ++ ck_assert_ptr_nonnull(num); ++ ck_assert(*num == 0LL); + lr_free(num); + } + END_TEST +@@ -44,7 +44,7 @@ START_TEST(test_gettmpfile) + { + int fd = 0; + fd = lr_gettmpfile(); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + close(fd); + } + END_TEST +@@ -52,8 +52,8 @@ END_TEST + START_TEST(test_gettmpdir) + { + char *tmp_dir = lr_gettmpdir(); +- fail_if(tmp_dir == NULL); +- fail_if(rmdir(tmp_dir) != 0); ++ ck_assert_ptr_nonnull(tmp_dir); ++ ck_assert_int_eq(rmdir(tmp_dir), 0); + lr_free(tmp_dir); + } + END_TEST +@@ -63,47 +63,47 @@ START_TEST(test_pathconcat) + char *path = NULL; + + path = lr_pathconcat(NULL, NULL); +- fail_if(path != NULL); ++ ck_assert_ptr_null(path); + + path = lr_pathconcat("", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, ""); + lr_free(path); + path = NULL; + + path = lr_pathconcat("/tmp", "foo///", "bar", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "/tmp/foo/bar")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, "/tmp/foo/bar"); + lr_free(path); + path = NULL; + + path = lr_pathconcat("foo", "bar/", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "foo/bar")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, "foo/bar"); + lr_free(path); + path = NULL; + + path = lr_pathconcat("foo", "/bar/", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "foo/bar")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, "foo/bar"); + lr_free(path); + path = NULL; + + path = lr_pathconcat("foo", "bar", "", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "foo/bar/")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, "foo/bar/"); + lr_free(path); + path = NULL; + + path = lr_pathconcat("http://host.net", "path/to/somewhere", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "http://host.net/path/to/somewhere")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, "http://host.net/path/to/somewhere"); + lr_free(path); + path = NULL; + + path = lr_pathconcat("http://host.net?hello=1", "path/to/", "somewhere", NULL); +- fail_if(path == NULL); +- fail_if(strcmp(path, "http://host.net/path/to/somewhere?hello=1")); ++ ck_assert_ptr_nonnull(path); ++ ck_assert_str_eq(path, "http://host.net/path/to/somewhere?hello=1"); + lr_free(path); + path = NULL; + } +@@ -116,16 +116,16 @@ START_TEST(test_remove_dir) + int fd, rc; + + tmp_dir = lr_gettmpdir(); +- fail_if(tmp_dir == NULL); ++ ck_assert_ptr_nonnull(tmp_dir); + tmp_file = lr_pathconcat(tmp_dir, "file_a", NULL); + fd = open(tmp_file, O_CREAT|O_TRUNC|O_RDWR, 0660); +- fail_if(fd < 0); ++ ck_assert_int_ge(fd, 0); + close(fd); + + rc = lr_remove_dir(tmp_dir); +- fail_if(rc != 0); +- fail_if(unlink(tmp_file) == 0); +- fail_if(rmdir(tmp_dir) == 0); ++ ck_assert_int_eq(rc, 0); ++ ck_assert_int_ne(unlink(tmp_file), 0); ++ ck_assert_int_ne(rmdir(tmp_dir), 0); + lr_free(tmp_dir); + lr_free(tmp_file); + } +@@ -136,65 +136,65 @@ START_TEST(test_url_without_path) + char *new_url = NULL; + + new_url = lr_url_without_path(NULL); +- fail_if(new_url != NULL); ++ ck_assert_ptr_null(new_url); + + new_url = lr_url_without_path(""); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, ""); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("hostname"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "hostname")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "hostname"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("hostname/foo/bar/"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "hostname")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "hostname"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("hostname:80"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "hostname:80")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "hostname:80"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("hostname:80/foo/bar"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "hostname:80")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "hostname:80"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("http://hostname:80/"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "http://hostname:80")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "http://hostname:80"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("http://hostname:80/foo/bar"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "http://hostname:80")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "http://hostname:80"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("ftp://foo.hostname:80/foo/bar"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "ftp://foo.hostname:80")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "ftp://foo.hostname:80"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("file:///home/foobar"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "file://")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "file://"); + lr_free(new_url); + new_url = NULL; + + new_url = lr_url_without_path("file:/home/foobar"); +- fail_if(new_url == NULL); +- fail_if(strcmp(new_url, "file://")); ++ ck_assert_ptr_nonnull(new_url); ++ ck_assert_str_eq(new_url, "file://"); + lr_free(new_url); + new_url = NULL; + } +@@ -209,39 +209,39 @@ START_TEST(test_strv_dup) + gchar **copy = NULL; + + copy = lr_strv_dup(in0); +- fail_if(copy != NULL); ++ ck_assert_ptr_null(copy); + + copy = lr_strv_dup(in1); +- fail_if(!copy); +- fail_if(copy == in1); +- fail_if(copy[0] != NULL); ++ ck_assert(copy); ++ ck_assert_ptr_ne(copy, in1); ++ ck_assert_ptr_null(copy[0]); + g_strfreev(copy); + + copy = lr_strv_dup(in2); +- fail_if(!copy); +- fail_if(copy == in2); +- fail_if(g_strcmp0(copy[0], "foo")); +- fail_if(copy[0] == in2[0]); +- fail_if(copy[1] != NULL); ++ ck_assert(copy); ++ ck_assert_ptr_ne(copy, in2); ++ ck_assert_str_eq(copy[0], "foo"); ++ ck_assert_ptr_ne(copy[0], in2[0]); ++ ck_assert_ptr_null(copy[1]); + g_strfreev(copy); + } + END_TEST + + START_TEST(test_is_local_path) + { +- fail_if(!lr_is_local_path("/tmp")); +- fail_if(!lr_is_local_path("foo/bar")); +- fail_if(!lr_is_local_path("bar")); +- fail_if(!lr_is_local_path("/")); +- fail_if(!lr_is_local_path("file:///tmp")); +- fail_if(!lr_is_local_path("file:/tmp")); +- +- fail_if(lr_is_local_path(NULL)); +- fail_if(lr_is_local_path("")); +- fail_if(lr_is_local_path("http://foo.bar")); +- fail_if(lr_is_local_path("https://foo.bar/x")); +- fail_if(lr_is_local_path("ftp://foo.bar/foobar")); +- fail_if(lr_is_local_path("rsync://xyz")); ++ ck_assert(lr_is_local_path("/tmp")); ++ ck_assert(lr_is_local_path("foo/bar")); ++ ck_assert(lr_is_local_path("bar")); ++ ck_assert(lr_is_local_path("/")); ++ ck_assert(lr_is_local_path("file:///tmp")); ++ ck_assert(lr_is_local_path("file:/tmp")); ++ ++ ck_assert(!lr_is_local_path(NULL)); ++ ck_assert(!lr_is_local_path("")); ++ ck_assert(!lr_is_local_path("http://foo.bar")); ++ ck_assert(!lr_is_local_path("https://foo.bar/x")); ++ ck_assert(!lr_is_local_path("ftp://foo.bar/foobar")); ++ ck_assert(!lr_is_local_path("rsync://xyz")); + } + END_TEST + +@@ -250,19 +250,19 @@ START_TEST(test_prepend_url_protocol) + gchar *url = NULL; + + url = lr_prepend_url_protocol("/tmp"); +- fail_if(g_strcmp0(url, "file:///tmp")); ++ ck_assert_str_eq(url, "file:///tmp"); + g_free(url); + + url = lr_prepend_url_protocol("file:///tmp"); +- fail_if(g_strcmp0(url, "file:///tmp")); ++ ck_assert_str_eq(url, "file:///tmp"); + g_free(url); + + url = lr_prepend_url_protocol("http://tmp"); +- fail_if(g_strcmp0(url, "http://tmp")); ++ ck_assert_str_eq(url, "http://tmp"); + g_free(url); + + url = lr_prepend_url_protocol("file:/tmp"); +- fail_if(g_strcmp0(url, "file:/tmp")); ++ ck_assert_str_eq(url, "file:/tmp"); + g_free(url); + } + END_TEST +diff --git a/tests/test_version.c b/tests/test_version.c +index 235b4c6e..96e6ec69 100644 +--- a/tests/test_version.c ++++ b/tests/test_version.c +@@ -10,23 +10,23 @@ + + START_TEST(test_version_check_macro) + { +- fail_if(!(LR_VERSION_CHECK(LR_VERSION_MAJOR, ++ ck_assert(LR_VERSION_CHECK(LR_VERSION_MAJOR, + LR_VERSION_MINOR, +- LR_VERSION_PATCH))); ++ LR_VERSION_PATCH)); + +- fail_if(!(LR_VERSION_CHECK(0, 0, 0))); ++ ck_assert(LR_VERSION_CHECK(0, 0, 0)); + +- fail_if(LR_VERSION_CHECK(LR_VERSION_MAJOR, +- LR_VERSION_MINOR, +- LR_VERSION_PATCH+1)); ++ ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR, ++ LR_VERSION_MINOR, ++ LR_VERSION_PATCH+1))); + +- fail_if(LR_VERSION_CHECK(LR_VERSION_MAJOR, +- LR_VERSION_MINOR+1, +- LR_VERSION_PATCH)); ++ ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR, ++ LR_VERSION_MINOR+1, ++ LR_VERSION_PATCH))); + +- fail_if(LR_VERSION_CHECK(LR_VERSION_MAJOR+1, +- LR_VERSION_MINOR, +- LR_VERSION_PATCH)); ++ ck_assert(!(LR_VERSION_CHECK(LR_VERSION_MAJOR+1, ++ LR_VERSION_MINOR, ++ LR_VERSION_PATCH))); + } + END_TEST + diff --git a/librepo.spec b/librepo.spec index 5d93714..ab5f622 100644 --- a/librepo.spec +++ b/librepo.spec @@ -12,7 +12,7 @@ Name: librepo Version: 1.14.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Repodata downloading library License: LGPLv2+ @@ -20,6 +20,8 @@ URL: https://github.com/rpm-software-management/librepo Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Patch1: 0001-Replace-python3-flask-with-httpserver-in-python-tests.patch Patch2: 0002-Recover-from-fsync-fail-on-read-only-filesystem-RhBu.patch +Patch3: 0003-Covscan-warnings-and-fail_if-deprication.patch +Patch4: 0004-fail_if-and-fail_unless-are-deprecated.patch BuildRequires: cmake BuildRequires: gcc @@ -98,6 +100,9 @@ Python 3 bindings for the librepo library. %{python3_sitearch}/%{name}/ %changelog +* Tue Jul 27 2021 Pavla Kratochvilova - 1.14.0-5 +- Fix issues detected by static analyzers + * Tue Jul 13 2021 Marek Blaha - 1.14.0-4 - Recover from fsync fail on read-only filesystem (RhBug:1981194)