A small patch to eliminate the python dependency in rev-cache's test-suite. This is a holdover for the 'integration' patch until a revised patchset is sent. Signed-off-by: Nick Edelen <sirnot@xxxxxxxxx> --- I've also implemented name caching, but I'd like to cleanup that (and the docs ;-) up a bit before posting it. I'll have everything ready for public display by tonight (I've got an appointment for the next several hours). t/t6015-rev-cache-list.sh | 39 +++++++++++++++++++++------------------ t/t6015-sha1-dump-diff.py | 36 ------------------------------------ 2 files changed, 21 insertions(+), 54 deletions(-) diff --git a/t/t6015-rev-cache-list.sh b/t/t6015-rev-cache-list.sh index bfd9525..7c3719d 100755 --- a/t/t6015-rev-cache-list.sh +++ b/t/t6015-rev-cache-list.sh @@ -3,7 +3,11 @@ test_description='git rev-cache tests' . ./test-lib.sh -sha1diff="python $TEST_DIRECTORY/t6015-sha1-dump-diff.py" +test_cmp_sorted() { + grep -io "[a-f0-9]*" $1 | sort >.tmpfile1 && + grep -io "[a-f0-9]*" $2 | sort >.tmpfile2 && + test_cmp .tmpfile1 .tmpfile2 +} # we want a totally wacked out branch structure... # we need branching and merging of sizes up through 3, tree @@ -99,49 +103,49 @@ test_expect_success 'remake cache slice' ' #check core mechanics and rev-list hook for commits test_expect_success 'test rev-caches walker directly (limited)' ' git-rev-cache walk HEAD --not HEAD~3 >list && - test -z `$sha1diff list proper_commit_list_limited` + test_cmp_sorted list proper_commit_list_limited ' test_expect_success 'test rev-caches walker directly (unlimited)' ' git-rev-cache walk HEAD >list && - test -z `$sha1diff list proper_commit_list` + test_cmp_sorted list proper_commit_list ' test_expect_success 'test rev-list traversal (limited)' ' git-rev-list HEAD --not HEAD~3 >list && - test -z `$sha1diff list proper_commit_list_limited` + test_cmp list proper_commit_list_limited ' test_expect_success 'test rev-list traversal (unlimited)' ' git-rev-list HEAD >list && - test -z `$sha1diff list proper_commit_list` + test_cmp list proper_commit_list ' #do the same for objects test_expect_success 'test rev-caches walker with objects' ' git-rev-cache walk --objects HEAD >list && - test -z `$sha1diff list proper_object_list` + test_cmp_sorted list proper_object_list ' test_expect_success 'test rev-list with objects (topo order)' ' git-rev-list --topo-order --objects HEAD >list && - test -z `$sha1diff list proper_object_list` + test_cmp_sorted list proper_object_list ' test_expect_success 'test rev-list with objects (no order)' ' git-rev-list --objects HEAD >list && - test -z `$sha1diff list proper_object_list` + test_cmp_sorted list proper_object_list ' #verify age limiting test_expect_success 'test rev-list date limiting (topo order)' ' git-rev-list --topo-order --max-age=$min_date --min-age=$max_date HEAD >list && - test -z `$sha1diff list proper_list_date_limited` + test_cmp_sorted list proper_list_date_limited ' test_expect_success 'test rev-list date limiting (no order)' ' git-rev-list --max-age=$min_date --min-age=$max_date HEAD >list && - test -z `sha1diff list proper_list_date_limited` + test_cmp_sorted list proper_list_date_limited ' #check partial cache slice @@ -154,7 +158,7 @@ test_expect_success 'saving old cache and generating partial slice' ' ' test_expect_success 'rev-list with wholly interesting partial slice' ' - git-rev-list --topo-order HEAD >list && + git-rev-list --topo-order HEAD >list && test_cmp list proper_commit_list ' @@ -199,13 +203,13 @@ test_expect_success 'corrupt slice' ' ' test_expect_success 'test rev-list traversal (limited) (corrupt slice)' ' - git-rev-list HEAD --not HEAD~3 >list && - test -z `$sha1diff list proper_commit_list_limited` + git-rev-list --topo-order HEAD --not HEAD~3 >list && + test_cmp list proper_commit_list_limited ' test_expect_success 'test rev-list traversal (unlimited) (corrupt slice)' ' git-rev-list HEAD >list && - test -z `$sha1diff list proper_commit_list` + test_cmp_sorted list proper_commit_list ' test_expect_success 'corrupt index' ' @@ -213,16 +217,15 @@ test_expect_success 'corrupt index' ' ' test_expect_success 'test rev-list traversal (limited) (corrupt index)' ' - git-rev-list HEAD --not HEAD~3 >list && - test -z `$sha1diff list proper_commit_list_limited` + git-rev-list --topo-order HEAD --not HEAD~3 >list && + test_cmp list proper_commit_list_limited ' test_expect_success 'test rev-list traversal (unlimited) (corrupt index)' ' git-rev-list HEAD >list && - test -z `$sha1diff list proper_commit_list` + test_cmp_sorted list proper_commit_list ' #test --ignore-size in fuse? test_done - diff --git a/t/t6015-sha1-dump-diff.py b/t/t6015-sha1-dump-diff.py deleted file mode 100755 index 7fc30e7..0000000 --- a/t/t6015-sha1-dump-diff.py +++ /dev/null @@ -1,36 +0,0 @@ - -import sys, re - -if len(sys.argv) < 3 : - sys.exit(0) - -f = open(sys.argv[1], 'r') -dict = {} -for line in f : - if len(line) >= 40 and re.match(r'^[0-9a-fA-F]{40}', line[:40]) != None : - dict[line[:40]] = 1 - -f.close() - -f = open(sys.argv[2], 'r') -for line in f : - if len(line) < 40 : - continue - - hash = line[:40] - if re.match(r'^[0-9a-fA-F]{40}', hash) == None : - continue - - if hash in dict : - dict[hash] -= 1 - else : - dict[hash] = -1 - -f.close() - -for k in dict.keys() : - if dict[k] == 0 : - del dict[k] - -if len(dict) : - print dict --- -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html