From 6f49f17f22a20d9a48723fe5a697d54869be3836 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 20 Nov 2024 15:12:23 -0400 Subject: [PATCH] in test suite display error from git push that fails to exit nonzero --- Test.hs | 8 +++-- Test/Framework.hs | 8 ++++- ..._edf45de127e639174893775d41e5a6c5._comment | 32 +++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 doc/bugs/tests_started_to_fail_recently/comment_5_edf45de127e639174893775d41e5a6c5._comment diff --git a/Test.hs b/Test.hs index 9796608365..7c08d3e948 100644 --- a/Test.hs +++ b/Test.hs @@ -446,10 +446,12 @@ test_git_remote_annex exporttree git_annex "get" [] "get failed" () <- populate git "config" ["remote.foo.url", "annex::"] "git config" - git "push" ["foo", "master"] "git push" - git "push" ["foo", "git-annex"] "git push" + -- git push does not always propagate nonzero exit + -- status from git-remote-annex, so remember the + -- transcript and display it if clone fails + pushtranscript <- testProcess' "git" ["push", "foo", "master", "git-annex"] Nothing (== True) (const True) "git push" git "clone" ["annex::"++diruuid++"?"++intercalate "&" cfg', "clonedir"] - "git clone from special remote" + ("git clone from special remote (after git push with output: " ++ pushtranscript ++ ")") inpath "clonedir" $ git_annex "get" [annexedfile] "get from origin special remote" diruuid="89ddefa4-a04c-11ef-87b5-e880882a4f98" diff --git a/Test/Framework.hs b/Test/Framework.hs index c249e93529..ab6645308f 100644 --- a/Test/Framework.hs +++ b/Test/Framework.hs @@ -73,7 +73,11 @@ import qualified Command.Uninit -- In debug mode, the output is allowed to pass through. -- So the output does not get checked in debug mode. testProcess :: String -> [String] -> Maybe [(String, String)] -> (Bool -> Bool) -> (String -> Bool) -> String -> Assertion -testProcess command params environ expectedret expectedtranscript faildesc = do +testProcess command params environ expectedret expectedtranscript faildesc = + void $ testProcess' command params environ expectedret expectedtranscript faildesc + +testProcess' :: String -> [String] -> Maybe [(String, String)] -> (Bool -> Bool) -> (String -> Bool) -> String -> IO String +testProcess' command params environ expectedret expectedtranscript faildesc = do let p = (proc command params) { env = environ } debug <- testDebug . testOptions <$> getTestMode if debug @@ -81,10 +85,12 @@ testProcess command params environ expectedret expectedtranscript faildesc = do ret <- withCreateProcess p $ \_ _ _ pid -> waitForProcess pid (expectedret (ret == ExitSuccess)) @? (faildesc ++ " failed with unexpected exit code") + return "" else do (transcript, ret) <- Utility.Process.Transcript.processTranscript' p Nothing (expectedret ret) @? (faildesc ++ " failed with unexpected exit code (transcript follows)\n" ++ transcript) (expectedtranscript transcript) @? (faildesc ++ " failed with unexpected output (transcript follows)\n" ++ transcript) + return transcript -- Run git. (Do not use to run git-annex as the one being tested -- may not be in path.) diff --git a/doc/bugs/tests_started_to_fail_recently/comment_5_edf45de127e639174893775d41e5a6c5._comment b/doc/bugs/tests_started_to_fail_recently/comment_5_edf45de127e639174893775d41e5a6c5._comment new file mode 100644 index 0000000000..b7eb3e6fda --- /dev/null +++ b/doc/bugs/tests_started_to_fail_recently/comment_5_edf45de127e639174893775d41e5a6c5._comment @@ -0,0 +1,32 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 5""" + date="2024-11-20T17:42:57Z" + content=""" +My arm64-ancient build failed today in the same way as the OSX build is failing, +so I should be able to debug it there. + + builder@sparrow:~/x/a$ git push d git-annex + Full remote url: annex::f88d4965-fc4f-4dd0-aac2-eaf19c9bcfa5?encryption=none&type=directory + fatal: Refusing to create empty bundle. + Push failed (user error (git ["--git-dir=.git","--work-tree=.","--literal-pathspecs","bundle","create","--quiet","/tmp/GITBUNDLE1049637-0","--stdin"] exited 128)) + warning: helper reported unexpected status of push + Everything up-to-date + builder@sparrow:~/x/a$ echo $? + 0 + +Huh ok, so git-remote-annex is failing to push, which is why clone +later fails. And for whatever reason git doesn't propigate the error, which +is why this is not visible in the transcript. + +That build uses git 2.30.2. That git bundle --stdin was broken and +didn't read refs from stdin at all. Also it had other bugs. I think it's +best not to try to support git-remote-annex with that version of git at +all, given those bugs. + +That probably won't help with the OSX failure, which is with a very new git +version. So I also made the test +suite capture the git push output even when it exits successfully, so it +can display it when the git pull fails. That should show what the problem +is there. +"""]]