summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/disable-flaky-stat-tests.patch133
-rw-r--r--debian/patches/disable-online-tests.patch28
-rw-r--r--debian/patches/handle-bashism.patch19
-rw-r--r--debian/patches/series3
4 files changed, 183 insertions, 0 deletions
diff --git a/debian/patches/disable-flaky-stat-tests.patch b/debian/patches/disable-flaky-stat-tests.patch
new file mode 100644
index 0000000..02ef286
--- /dev/null
+++ b/debian/patches/disable-flaky-stat-tests.patch
@@ -0,0 +1,133 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Wed, 31 Aug 2022 15:24:06 +0200
+Subject: Ignore test failures because of stat()
+
+Forwarded: not-needed
+---
+ tests/libgit2/repo/init.c | 14 ++++++++------
+ tests/libgit2/repo/template.c | 19 +++++++++++--------
+ tests/util/copy.c | 12 ++++++++----
+ tests/util/mkdir.c | 2 ++
+ 4 files changed, 29 insertions(+), 18 deletions(-)
+
+diff --git a/tests/libgit2/repo/init.c b/tests/libgit2/repo/init.c
+index d78ec06..17a0ae2 100644
+--- a/tests/libgit2/repo/init.c
++++ b/tests/libgit2/repo/init.c
+@@ -443,12 +443,14 @@ void test_repo_init__extended_1(void)
+ cl_assert(!git_repository_is_empty(g_repo));
+
+ cl_git_pass(git_fs_path_lstat(git_repository_path(g_repo), &st));
+- cl_assert(S_ISDIR(st.st_mode));
+- if (cl_is_chmod_supported())
+- cl_assert((S_ISGID & st.st_mode) == S_ISGID);
+- else
+- cl_assert((S_ISGID & st.st_mode) == 0);
+-
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ {
++ cl_assert(S_ISDIR(st.st_mode));
++ if (cl_is_chmod_supported())
++ cl_assert((S_ISGID & st.st_mode) == S_ISGID);
++ else
++ cl_assert((S_ISGID & st.st_mode) == 0);
++ }
+ cl_git_pass(git_reference_lookup(&ref, g_repo, "HEAD"));
+ cl_assert(git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC);
+ cl_assert_equal_s("refs/heads/development", git_reference_symbolic_target(ref));
+diff --git a/tests/libgit2/repo/template.c b/tests/libgit2/repo/template.c
+index e8fe266..f771f4e 100644
+--- a/tests/libgit2/repo/template.c
++++ b/tests/libgit2/repo/template.c
+@@ -72,8 +72,8 @@ static void assert_hooks_match(
+ CLEAR_FOR_CORE_FILEMODE(expected_mode);
+ CLEAR_FOR_CORE_FILEMODE(st.st_mode);
+ }
+-
+- cl_assert_equal_i_fmt(expected_mode, st.st_mode, "%07o");
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ cl_assert_equal_i_fmt(expected_mode, st.st_mode, "%07o");
+ }
+
+ git_str_dispose(&expected);
+@@ -97,14 +97,17 @@ static void assert_mode_seems_okay(
+ expect_setgid = false;
+ }
+
+- if (S_ISGID != 0)
+- cl_assert_equal_b(expect_setgid, (st.st_mode & S_ISGID) != 0);
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ {
++ if (S_ISGID != 0)
++ cl_assert_equal_b(expect_setgid, (st.st_mode & S_ISGID) != 0);
+
+- cl_assert_equal_b(
+- GIT_PERMS_IS_EXEC(expect_mode), GIT_PERMS_IS_EXEC(st.st_mode));
++ cl_assert_equal_b(
++ GIT_PERMS_IS_EXEC(expect_mode), GIT_PERMS_IS_EXEC(st.st_mode));
+
+- cl_assert_equal_i_fmt(
+- GIT_MODE_TYPE(expect_mode), GIT_MODE_TYPE(st.st_mode), "%07o");
++ cl_assert_equal_i_fmt(
++ GIT_MODE_TYPE(expect_mode), GIT_MODE_TYPE(st.st_mode), "%07o");
++ }
+ }
+
+ static void setup_repo(const char *name, git_repository_init_options *opts)
+diff --git a/tests/util/copy.c b/tests/util/copy.c
+index 2613730..1b74f0d 100644
+--- a/tests/util/copy.c
++++ b/tests/util/copy.c
+@@ -12,7 +12,8 @@ void test_copy__file(void)
+ cl_git_pass(git_futils_cp("copy_me", "copy_me_two", 0664));
+
+ cl_git_pass(git_fs_path_lstat("copy_me_two", &st));
+- cl_assert(S_ISREG(st.st_mode));
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ cl_assert(S_ISREG(st.st_mode));
+
+ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
+ cl_assert_equal_sz(strlen(content), (size_t)st.st_size);
+@@ -39,7 +40,8 @@ void test_copy__file_in_dir(void)
+ 0664));
+
+ cl_git_pass(git_fs_path_lstat("an_dir/second_dir/and_more/copy_me_two", &st));
+- cl_assert(S_ISREG(st.st_mode));
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ cl_assert(S_ISREG(st.st_mode));
+
+ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
+ cl_assert_equal_sz(strlen(content), (size_t)st.st_size);
+@@ -103,7 +105,8 @@ void test_copy__tree(void)
+
+ memset(&st, 0, sizeof(struct stat));
+ cl_git_pass(git_fs_path_lstat("t1/c/f3", &st));
+- cl_assert(S_ISREG(st.st_mode));
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ cl_assert(S_ISREG(st.st_mode));
+
+ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
+ cl_assert_equal_sz(strlen(content), (size_t)st.st_size);
+@@ -111,7 +114,8 @@ void test_copy__tree(void)
+ #ifndef GIT_WIN32
+ memset(&st, 0, sizeof(struct stat));
+ cl_git_pass(git_fs_path_lstat("t1/c/d/l1", &st));
+- cl_assert(S_ISLNK(st.st_mode));
++ if (!cl_is_env_set("GITTEST_FLAKY_STAT"))
++ cl_assert(S_ISLNK(st.st_mode));
+ #endif
+
+ cl_git_pass(git_futils_rmdir_r("t1", NULL, GIT_RMDIR_REMOVE_FILES));
+diff --git a/tests/util/mkdir.c b/tests/util/mkdir.c
+index 8658eec..1c944e7 100644
+--- a/tests/util/mkdir.c
++++ b/tests/util/mkdir.c
+@@ -160,6 +160,8 @@ static void check_mode_at_line(
+ expected &= 0600;
+ actual &= 0600;
+ }
++ if (cl_is_env_set("GITTEST_FLAKY_STAT"))
++ return;
+
+ clar__assert_equal(
+ file, func, line, "expected_mode != actual_mode", 1,
diff --git a/debian/patches/disable-online-tests.patch b/debian/patches/disable-online-tests.patch
new file mode 100644
index 0000000..3470ea3
--- /dev/null
+++ b/debian/patches/disable-online-tests.patch
@@ -0,0 +1,28 @@
+From: Utkarsh Gupta <utkarsh@debian.org>
+Date: Sun, 28 Aug 2022 17:12:49 +0200
+Subject: disable-online-tests
+
+Skip tests that needs an active internet connection
+
+Forwarded: not-needed
+---
+ tests/libgit2/CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/libgit2/CMakeLists.txt b/tests/libgit2/CMakeLists.txt
+index af70f55..246da96 100644
+--- a/tests/libgit2/CMakeLists.txt
++++ b/tests/libgit2/CMakeLists.txt
+@@ -66,6 +66,7 @@ endif()
+ include(AddClarTest)
+ add_clar_test(libgit2_tests offline -v -xonline)
+ add_clar_test(libgit2_tests invasive -v -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root -sonline::clone::connect_timeout_default)
++if(NOT DISABLE_ONLINE_TESTS)
+ add_clar_test(libgit2_tests online -v -sonline -xonline::customcert)
+ add_clar_test(libgit2_tests online_customcert -v -sonline::customcert)
+ add_clar_test(libgit2_tests gitdaemon -v -sonline::push)
+@@ -75,3 +76,4 @@ add_clar_test(libgit2_tests ssh -v -sonline::push -sonline::clon
+ add_clar_test(libgit2_tests proxy -v -sonline::clone::proxy)
+ add_clar_test(libgit2_tests auth_clone -v -sonline::clone::cred)
+ add_clar_test(libgit2_tests auth_clone_and_push -v -sonline::clone::push -sonline::push)
++endif()
diff --git a/debian/patches/handle-bashism.patch b/debian/patches/handle-bashism.patch
new file mode 100644
index 0000000..907ccf7
--- /dev/null
+++ b/debian/patches/handle-bashism.patch
@@ -0,0 +1,19 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Sun, 28 Aug 2022 17:42:55 +0200
+Subject: Use bash for shell script with bashisms
+
+Forwarded: https://github.com/libgit2/libgit2/pull/6581
+---
+ tests/resources/push.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/resources/push.sh b/tests/resources/push.sh
+index 3e77fb5..54ef3dd 100644
+--- a/tests/resources/push.sh
++++ b/tests/resources/push.sh
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ #creates push_src repo for libgit2 push tests.
+ set -eu
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ddeb33d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+disable-online-tests.patch
+handle-bashism.patch
+disable-flaky-stat-tests.patch