in test suite display error from git push that fails to exit nonzero

This commit is contained in:
Joey Hess 2024-11-20 15:12:23 -04:00
parent 31a38f8468
commit 6f49f17f22
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 44 additions and 4 deletions

View file

@ -446,10 +446,12 @@ test_git_remote_annex exporttree
git_annex "get" [] "get failed" git_annex "get" [] "get failed"
() <- populate () <- populate
git "config" ["remote.foo.url", "annex::"] "git config" git "config" ["remote.foo.url", "annex::"] "git config"
git "push" ["foo", "master"] "git push" -- git push does not always propagate nonzero exit
git "push" ["foo", "git-annex"] "git push" -- 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" ["annex::"++diruuid++"?"++intercalate "&" cfg', "clonedir"]
"git clone from special remote" ("git clone from special remote (after git push with output: " ++ pushtranscript ++ ")")
inpath "clonedir" $ inpath "clonedir" $
git_annex "get" [annexedfile] "get from origin special remote" git_annex "get" [annexedfile] "get from origin special remote"
diruuid="89ddefa4-a04c-11ef-87b5-e880882a4f98" diruuid="89ddefa4-a04c-11ef-87b5-e880882a4f98"

View file

@ -73,7 +73,11 @@ import qualified Command.Uninit
-- In debug mode, the output is allowed to pass through. -- In debug mode, the output is allowed to pass through.
-- So the output does not get checked in debug mode. -- So the output does not get checked in debug mode.
testProcess :: String -> [String] -> Maybe [(String, String)] -> (Bool -> Bool) -> (String -> Bool) -> String -> Assertion 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 } let p = (proc command params) { env = environ }
debug <- testDebug . testOptions <$> getTestMode debug <- testDebug . testOptions <$> getTestMode
if debug if debug
@ -81,10 +85,12 @@ testProcess command params environ expectedret expectedtranscript faildesc = do
ret <- withCreateProcess p $ \_ _ _ pid -> ret <- withCreateProcess p $ \_ _ _ pid ->
waitForProcess pid waitForProcess pid
(expectedret (ret == ExitSuccess)) @? (faildesc ++ " failed with unexpected exit code") (expectedret (ret == ExitSuccess)) @? (faildesc ++ " failed with unexpected exit code")
return ""
else do else do
(transcript, ret) <- Utility.Process.Transcript.processTranscript' p Nothing (transcript, ret) <- Utility.Process.Transcript.processTranscript' p Nothing
(expectedret ret) @? (faildesc ++ " failed with unexpected exit code (transcript follows)\n" ++ transcript) (expectedret ret) @? (faildesc ++ " failed with unexpected exit code (transcript follows)\n" ++ transcript)
(expectedtranscript transcript) @? (faildesc ++ " failed with unexpected output (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 -- Run git. (Do not use to run git-annex as the one being tested
-- may not be in path.) -- may not be in path.)

View file

@ -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.
"""]]