#!/bin/sh global test_description := ''racy GIT'' source ./test-lib.sh # This test can give false success if your machine is sufficiently # slow or your trial happened to happen on second boundary. for trial in [0 1 2 3 4] { rm -f .git/index echo frotz >infocom git update-index --add infocom echo xyzzy >infocom global files := $[git diff-files -p] test_expect_success \ "Racy GIT trial #$trial part A" \ 'test "" != "$files"' sleep 1 echo xyzzy >cornerstone git update-index --add cornerstone global files := $[git diff-files -p] test_expect_success \ "Racy GIT trial #$trial part B" \ 'test "" != "$files"' } test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"racy GIT">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (ForEach iter_name: trial iter_words: [{(0)} {(1)} {(2)} {(3)} {(4)}] do_arg_iter: False body: (DoGroup children: [ (C {(rm)} {(-f)} {(.git/index)}) (SimpleCommand words: [{(echo)} {(frotz)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(infocom)} spids:[52])] ) (C {(git)} {(update-index)} {(--add)} {(infocom)}) (SimpleCommand words: [{(echo)} {(xyzzy)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(infocom)} spids:[69])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:files) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(git)} {(diff-files)} {(-p)})]) left_token: spids: [75 81] ) } spids: [74] ) ] spids: [74] ) (C {(test_expect_success)} {(DQ ("Racy GIT trial #") ($ VSub_Name "$trial") (" part A"))} {(SQ <"test \"\" != \"$files\"">)} ) (C {(sleep)} {(1)}) (SimpleCommand words: [{(echo)} {(xyzzy)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(cornerstone)} spids:[111])] ) (C {(git)} {(update-index)} {(--add)} {(cornerstone)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:files) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(git)} {(diff-files)} {(-p)})]) left_token: spids: [126 132] ) } spids: [125] ) ] spids: [125] ) (C {(test_expect_success)} {(DQ ("Racy GIT trial #") ($ VSub_Name "$trial") (" part B"))} {(SQ <"test \"\" != \"$files\"">)} ) ] spids: [38 152] ) spids: [27 -1] ) (C {(test_done)}) ] )