{"thread":{"id":"7611","subject":"[PATCH 2/2] use test-genrandom in tests instead of /dev/urandom","startedAt":"2007-04-11T17:35:13Z","lastAt":"2007-04-11T17:35:13Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"39125","messageId":"alpine.LFD.0.98.0704111333560.28181@xanadu.home","threadId":"7611","inReplyTo":null,"subject":"[PATCH 2/2] use test-genrandom in tests instead of /dev/urandom","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-04-11T17:35:13Z","receivedAt":"2007-04-11T17:35:13Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"This way tests are completely deterministic and possibly more portable.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n t/t5301-sliding-window.sh |    2 +-\n t/t5302-pack-index.sh     |    9 ++++-----\n 2 files changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh\nindex a6dbb04..fce77f1 100755\n--- a/t/t5301-sliding-window.sh\n+++ b/t/t5301-sliding-window.sh\n@@ -12,7 +12,7 @@ test_expect_success \\\n      for i in a b c\n      do\n          echo $i >$i &&\n-         dd if=/dev/urandom bs=32k count=1 >>$i &&\n+         test-genrandom \"$i\" 32768 >>$i &&\n          git-update-index --add $i || return 1\n      done &&\n      echo d >d && cat c >>d && git-update-index --add d &&\ndiff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh\nindex 3371964..b863c17 100755\n--- a/t/t5302-pack-index.sh\n+++ b/t/t5302-pack-index.sh\n@@ -13,15 +13,14 @@ test_expect_success \\\n      for i in `seq -w 100`\n      do\n          echo $i >file_$i &&\n-         dd if=/dev/urandom bs=8k count=1 >>file_$i &&\n+         test-genrandom \"$i\" 8192 >>file_$i &&\n          git-update-index --add file_$i || return 1\n      done &&\n-     echo 101 >file_101 && tail -c 8k file_100 >>file_101 &&\n+     echo 101 >file_101 && tail -c 8192 file_100 >>file_101 &&\n      git-update-index --add file_101 &&\n      tree=`git-write-tree` &&\n      commit=`git-commit-tree $tree </dev/null` && {\n \t echo $tree &&\n-\t echo $commit &&\n \t git-ls-tree $tree | sed -e \"s/.* \\\\([0-9a-f]*\\\\)\t.*/\\\\1/\"\n      } >obj-list &&\n      git-update-ref HEAD $commit'\n@@ -78,7 +77,7 @@ test_expect_success \\\n     '[index v1] 1) stream pack to repository' \\\n     'git-index-pack --index-version=1 --stdin < \"test-1-${pack1}.pack\" &&\n      git-prune-packed &&\n-     test \"`git-count-objects`\" = \"0 objects, 0 kilobytes\" &&\n+     git-count-objects | ( read nr rest && test \"$nr\" -eq 1 ) &&\n      cmp \"test-1-${pack1}.pack\" \".git/objects/pack/pack-${pack1}.pack\" &&\n      cmp \"test-1-${pack1}.idx\"  \".git/objects/pack/pack-${pack1}.idx\"'\n \n@@ -116,7 +115,7 @@ test_expect_success \\\n     'rm -f .git/objects/pack/* &&\n      git-index-pack --index-version=2,0x40000 --stdin < \"test-1-${pack1}.pack\" &&\n      git-prune-packed &&\n-     test \"`git-count-objects`\" = \"0 objects, 0 kilobytes\" &&\n+     git-count-objects | ( read nr rest && test \"$nr\" -eq 1 ) &&\n      cmp \"test-1-${pack1}.pack\" \".git/objects/pack/pack-${pack1}.pack\" &&\n      cmp \"test-3-${pack1}.idx\"  \".git/objects/pack/pack-${pack1}.idx\"'\n \n-- \n1.5.1.777.gd14d3-dirty\n"}]}