git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/5] full integration of rev-cache into git's revision walker, completed test suite

From
NENick Edelen <sirnot@gmail.com>
Date
Aug 7, 2009, 13:47 UTC
Message-ID
<op.uyaolcvttdk399@sirnot.private>
In-Reply-To
<op.ux8i7ceotdk399@sirnot.private>

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@gmail.com>

--- 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
---
Previous: Sam Vilain
Message 3 of 3 in “full integration of rev-cache into git's revision walker, completed test suite”
  1. 5/5 full integration of rev-cache into git's revision walker, completed test suiteNick Edelen, Aug 6, 2009
  2. Sam VilainAug 7, 2009
  3. Nick EdelenAug 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.