summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-04-04 11:40:42 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2022-04-04 11:40:42 -0400
commit42093d6a8e2f2bf03645e9c33ef4add70bada02a (patch)
tree1d5149ac08fe2da16d733aec97a838cc6a3b3ed4 /tests
parentdb4461d556ddb7915349d094ba74ef01d7a2d701 (diff)
downloadlibgit2-42093d6a8e2f2bf03645e9c33ef4add70bada02a.tar.gz
diff: don't stat empty file on arm32 (flaky test)
Our CI test infrastructure virtualizes arm32 in docker, which is a sometimes imperfect situation. In `diff::workdir::can_diff_empty_file`, avoid the stat to ensure that the file is zero bytes; there is an odd issue running in qemu when emulating arm32 that we should skip.
Diffstat (limited to 'tests')
-rw-r--r--tests/libgit2/diff/workdir.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/libgit2/diff/workdir.c b/tests/libgit2/diff/workdir.c
index cdf53faa1..a3e92908c 100644
--- a/tests/libgit2/diff/workdir.c
+++ b/tests/libgit2/diff/workdir.c
@@ -1237,7 +1237,6 @@ void test_diff_workdir__can_diff_empty_file(void)
git_diff *diff;
git_tree *tree;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- struct stat st;
git_patch *patch;
g_repo = cl_git_sandbox_init("attr_index");
@@ -1251,10 +1250,15 @@ void test_diff_workdir__can_diff_empty_file(void)
git_diff_free(diff);
/* empty contents of file */
-
cl_git_rewritefile("attr_index/README.txt", "");
- cl_git_pass(git_fs_path_lstat("attr_index/README.txt", &st));
- cl_assert_equal_i(0, (int)st.st_size);
+
+#if !defined(__arm__) || !defined(GIT_ARCH_32)
+ {
+ struct stat st;
+ cl_git_pass(git_fs_path_lstat("attr_index/README.txt", &st));
+ cl_assert(st.st_size == 0);
+ }
+#endif
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));