summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschu <schu-github@schulog.org>2011-10-30 13:48:00 +0100
committerschu <schu-github@schulog.org>2011-10-30 13:48:00 +0100
commitec9079443c874fe1711acefb22b3fc606484c786 (patch)
treeee42e9446cf8200097611d2b20e31467cf8e8c9e
parentd3104fa0a3f3711729b45346e475354440d46cc3 (diff)
downloadlibgit2-ec9079443c874fe1711acefb22b3fc606484c786.tar.gz
test_helpers: do not rely on assert
The functions loose_object_mode and loose_object_dir_mode call stat inside an assert statement which isn't evaluated when compiling in Release mode (NDEBUG) and leads to failing tests. Replace it. Signed-off-by: schu <schu-github@schulog.org>
-rw-r--r--tests/test_helpers.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index 47a0b1b11..31e38bf6a 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -116,7 +116,8 @@ int loose_object_mode(const char *repository_folder, git_object *object)
struct stat st;
locate_loose_object(repository_folder, object, &object_path, NULL);
- assert(p_stat(object_path, &st) == 0);
+ if (p_stat(object_path, &st) < 0)
+ return 0;
free(object_path);
return st.st_mode;
@@ -138,7 +139,8 @@ int loose_object_dir_mode(const char *repository_folder, git_object *object)
}
}
- assert(p_stat(object_path, &st) == 0);
+ if (p_stat(object_path, &st) < 0)
+ return 0;
free(object_path);
return st.st_mode;