Skip to content

Commit

Permalink
Merge pull request #77 from ejoerns/v0/topic/fix-test-errors
Browse files Browse the repository at this point in the history
Fix test errors with glib 2.49
  • Loading branch information
jluebbe committed Sep 30, 2016
2 parents c014a90 + 4c4e006 commit 059943e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
9 changes: 9 additions & 0 deletions include/manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

#include <config_file.h>

#define R_MANIFEST_ERROR r_manifest_error_quark ()
GQuark r_manifest_error_quark (void);

#define R_MANIFEST_ERROR_NO_DATA 0
#define R_MANIFEST_ERROR_CHECKSUM 1
#define R_MANIFEST_ERROR_COMPATIBLE 2
#define R_MANIFEST_PARSE_ERROR 3
#define R_MANIFEST_EMPTY_STRING 4

typedef struct {
gboolean install_check;
} InstallHooks;
Expand Down
9 changes: 1 addition & 8 deletions src/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@
#define RAUC_FILE_PREFIX "file"

#define R_MANIFEST_ERROR r_manifest_error_quark ()

#define R_MANIFEST_ERROR_NO_DATA 0
#define R_MANIFEST_ERROR_CHECKSUM 1
#define R_MANIFEST_ERROR_COMPATIBLE 2
#define R_MANIFEST_PARSE_ERROR 3
#define R_MANIFEST_EMPTY_STRING 4

static GQuark r_manifest_error_quark (void)
GQuark r_manifest_error_quark (void)
{
return g_quark_from_static_string ("r_manifest_error_quark");
}
Expand Down
12 changes: 4 additions & 8 deletions test/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,28 @@ compatible=SuperBazzer\n\

data = g_bytes_new_static(MANIFEST2, sizeof(MANIFEST2));
g_assert_false(load_manifest_mem(data, &rm, &error));
g_assert_nonnull(error);
g_assert_cmpstr("Key file does not have key 'compatible'", ==, error->message);
g_assert_error(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
g_clear_error(&error);
g_assert_null(rm);
g_clear_pointer(&data, g_byte_array_free);

data = g_bytes_new_static(MANIFEST3, sizeof(MANIFEST3));
g_assert_false(load_manifest_mem(data, &rm, &error));
g_assert_nonnull(error);
g_assert_cmpstr("Missing value for key 'compatible'", ==, error->message);
g_assert_error(error, R_MANIFEST_ERROR, R_MANIFEST_EMPTY_STRING);
g_clear_error(&error);
g_assert_null(rm);
g_clear_pointer(&data, g_byte_array_free);

data = g_bytes_new_static(MANIFEST4, sizeof(MANIFEST4));
g_assert_false(load_manifest_mem(data, &rm, &error));
g_assert_nonnull(error);
g_assert_cmpstr("Invalid key 'evilkey' in group '[update]'", ==, error->message);
g_assert_error(error, R_MANIFEST_ERROR, R_MANIFEST_PARSE_ERROR);
g_clear_error(&error);
g_assert_null(rm);
g_clear_pointer(&data, g_byte_array_free);

data = g_bytes_new_static(MANIFEST5, sizeof(MANIFEST5));
g_assert_false(load_manifest_mem(data, &rm, &error));
g_assert_nonnull(error);
g_assert_cmpstr("Invalid group '[evilgroup]'", ==, error->message);
g_assert_error(error, R_MANIFEST_ERROR, R_MANIFEST_PARSE_ERROR);
g_clear_error(&error);
g_assert_null(rm);
g_clear_pointer(&data, g_byte_array_free);
Expand Down
18 changes: 9 additions & 9 deletions test/update_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,19 +625,19 @@ int main(int argc, char *argv[])
test_update_handler,
update_handler_fixture_tear_down);

g_test_add("/update_handler/update_handler/ext4_to_ext4/pre-hook/fail",
g_test_add("/update_handler/update_handler/tar_to_ext4/pre-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[28],
update_handler_fixture_set_up,
test_update_handler,
update_handler_fixture_tear_down);
g_test_add("/update_handler/update_handler/ext4_to_ext4/pre-hook/fail",
g_test_add("/update_handler/update_handler/img_to_raw/pre-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[29],
update_handler_fixture_set_up,
test_update_handler,
update_handler_fixture_tear_down);
g_test_add("/update_handler/update_handler/ext4_to_ext4/pre-hook/fail",
g_test_add("/update_handler/update_handler/ext4_to_raw/pre-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[30],
update_handler_fixture_set_up,
Expand All @@ -650,19 +650,19 @@ int main(int argc, char *argv[])
test_update_handler,
update_handler_fixture_tear_down);

g_test_add("/update_handler/update_handler/ext4_to_ext4/post-hook/fail",
g_test_add("/update_handler/update_handler/tar_to_ext4/post-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[32],
update_handler_fixture_set_up,
test_update_handler,
update_handler_fixture_tear_down);
g_test_add("/update_handler/update_handler/ext4_to_ext4/post-hook/fail",
g_test_add("/update_handler/update_handler/img_to_raw/post-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[33],
update_handler_fixture_set_up,
test_update_handler,
update_handler_fixture_tear_down);
g_test_add("/update_handler/update_handler/ext4_to_ext4/post-hook/fail",
g_test_add("/update_handler/update_handler/ext4_to_raw/post-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[34],
update_handler_fixture_set_up,
Expand All @@ -675,19 +675,19 @@ int main(int argc, char *argv[])
test_update_handler,
update_handler_fixture_tear_down);

g_test_add("/update_handler/update_handler/ext4_to_ext4/install-hook/fail",
g_test_add("/update_handler/update_handler/tar_to_ext4/install-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[36],
update_handler_fixture_set_up,
test_update_handler,
update_handler_fixture_tear_down);
g_test_add("/update_handler/update_handler/ext4_to_ext4/install-hook/fail",
g_test_add("/update_handler/update_handler/img_to_raw/install-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[37],
update_handler_fixture_set_up,
test_update_handler,
update_handler_fixture_tear_down);
g_test_add("/update_handler/update_handler/ext4_to_ext4/install-hook/fail",
g_test_add("/update_handler/update_handler/ext4_to_raw/install-hook/fail",
UpdateHandlerFixture,
&testpair_matrix[38],
update_handler_fixture_set_up,
Expand Down

0 comments on commit 059943e

Please sign in to comment.