Skip to content

Commit

Permalink
Patch t4205 to not run expensive tests on GitHub
Browse files Browse the repository at this point in the history
The expensive tests on t4205 fail on GitHub due to limited memory.  This
is a restriction of the GitHub runners, not a problem with the test, so
disable those tests when running in that environment.
  • Loading branch information
me-and committed Oct 25, 2023
1 parent 3025ece commit c1b441b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
4 changes: 3 additions & 1 deletion git.cygport
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ SRC_URI="https://git.kernel.org/pub/scm/git/git.git/snapshot/${PN}-v${PV}.tar.gz
SRC_DIR="${PN}-v${PV}"
LICENSE='GPL-2.0-only'

PATCH_URI='1.8.5.2-cygwin.patch expect-cygwin-test-failures.patch'
PATCH_URI='1.8.5.2-cygwin.patch
expect-cygwin-test-failures.patch
github-actions-memory.patch'

BUILD_REQUIRES="$(tr '\n' ' ' <build-requires.txt)"

Expand Down
41 changes: 41 additions & 0 deletions github-actions-memory.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--- a/git-2.42.0/t/t4205-log-pretty-formats.sh
+++ b/git-2.42.0/t/t4205-log-pretty-formats.sh
@@ -1084,24 +1084,24 @@ test_expect_success 'log --pretty truncation with control chars' '
test_cmp expect actual
'

-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!CYGWIN_GITHUB_ACTIONS 'log --pretty with huge commit message' '
# We only assert that this command does not crash. This needs to be
# executed with the address sanitizer to demonstrate failure.
git log -1 --pretty="format:%>(2147483646)%x41%41%>(2147483646)%x41" >/dev/null
'

-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'set up huge commit' '
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!CYGWIN_GITHUB_ACTIONS 'set up huge commit' '
test-tool genzeros 2147483649 | tr "\000" "1" >expect &&
huge_commit=$(git commit-tree -F expect HEAD^{tree})
'

-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!CYGWIN_GITHUB_ACTIONS 'log --pretty with huge commit message' '
git log -1 --format="%B%<(1)%x30" $huge_commit >actual &&
echo 0 >>expect &&
test_cmp expect actual
'

-test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message does not cause allocation failure' '
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!CYGWIN_GITHUB_ACTIONS 'log --pretty with huge commit message does not cause allocation failure' '
test_must_fail git log -1 --format="%<(1)%B" $huge_commit 2>error &&
cat >expect <<-EOF &&
fatal: number too large to represent as int on this platform: 2147483649
--- a/git-2.42.0/t/test-lib.sh
+++ b/git-2.42.0/t/test-lib.sh
@@ -1725,6 +1725,7 @@ case $uname_s in
test_set_prereq SED_STRIPS_CR
test_set_prereq GREP_STRIPS_CR
test_set_prereq WINDOWS
+ test -n "$GITHUB_ACTIONS" && test_set_prereq CYGWIN_GITHUB_ACTIONS
;;
*)
test_set_prereq POSIXPERM

0 comments on commit c1b441b

Please sign in to comment.