Skip to content

Commit 42093d6

Browse files
committed
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.
1 parent db4461d commit 42093d6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/libgit2/diff/workdir.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,6 @@ void test_diff_workdir__can_diff_empty_file(void)
12371237
git_diff *diff;
12381238
git_tree *tree;
12391239
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
1240-
struct stat st;
12411240
git_patch *patch;
12421241

12431242
g_repo = cl_git_sandbox_init("attr_index");
@@ -1251,10 +1250,15 @@ void test_diff_workdir__can_diff_empty_file(void)
12511250
git_diff_free(diff);
12521251

12531252
/* empty contents of file */
1254-
12551253
cl_git_rewritefile("attr_index/README.txt", "");
1256-
cl_git_pass(git_fs_path_lstat("attr_index/README.txt", &st));
1257-
cl_assert_equal_i(0, (int)st.st_size);
1254+
1255+
#if !defined(__arm__) || !defined(GIT_ARCH_32)
1256+
{
1257+
struct stat st;
1258+
cl_git_pass(git_fs_path_lstat("attr_index/README.txt", &st));
1259+
cl_assert(st.st_size == 0);
1260+
}
1261+
#endif
12581262

12591263
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
12601264
cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));

0 commit comments

Comments
 (0)