changeset 51361:fa4c4fa232d6 stable

tests: make sha256line.py available for all tests This was previously only used in test-revlog-delta-find.t, but it will be useful (and used) in other tests that might need to generate poorly-compressible files.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 24 Jan 2024 13:35:30 -0300
parents c7edfccfc11f
children e7be2ddfb4c2
files tests/sha256line.py tests/test-revlog-delta-find.t
diffstat 2 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/sha256line.py	Wed Jan 24 13:35:30 2024 -0300
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+#
+# A tool to help producing large and poorly compressible files
+#
+# Usage:
+#   $TESTDIR/seq.py 1000 | $TESTDIR/sha256line.py > my-file.txt
+
+
+import hashlib
+import sys
+
+
+for line in sys.stdin:
+    print(hashlib.sha256(line.encode('utf8')).hexdigest())
--- a/tests/test-revlog-delta-find.t	Sun Jan 14 16:03:08 2024 -0300
+++ b/tests/test-revlog-delta-find.t	Wed Jan 24 13:35:30 2024 -0300
@@ -10,20 +10,13 @@
   > [debug]
   > revlog.debug-delta=yes
   > EOF
-  $ cat << EOF >> sha256line.py
-  > # a way to quickly produce file of significant size and poorly compressable content.
-  > import hashlib
-  > import sys
-  > for line in sys.stdin:
-  >     print(hashlib.sha256(line.encode('utf8')).hexdigest())
-  > EOF
 
   $ hg init base-repo
   $ cd base-repo
 
 create a "large" file
 
-  $ $TESTDIR/seq.py 1000 | $PYTHON $TESTTMP/sha256line.py > my-file.txt
+  $ $TESTDIR/seq.py 1000 | $TESTDIR/sha256line.py > my-file.txt
   $ hg add my-file.txt
   $ hg commit -m initial-commit
   DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob)
@@ -32,7 +25,7 @@
 
 Add more change at the end of the file
 
-  $ $TESTDIR/seq.py 1001 1200 | $PYTHON $TESTTMP/sha256line.py >> my-file.txt
+  $ $TESTDIR/seq.py 1001 1200 | $TESTDIR/sha256line.py >> my-file.txt
   $ hg commit -m "large-change"
   DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob)
   DBG-DELTAS: MANIFESTLOG: * (glob)
@@ -273,7 +266,7 @@
 
   $ hg -R peer-bad-delta-with-full update 'desc("merge")' --quiet
   $ ($TESTDIR/seq.py 2000 2100; $TESTDIR/seq.py 500 510; $TESTDIR/seq.py 3000 3050) \
-  > | $PYTHON $TESTTMP/sha256line.py > peer-bad-delta-with-full/my-file.txt
+  > | $TESTDIR/sha256line.py > peer-bad-delta-with-full/my-file.txt
   $ hg -R peer-bad-delta-with-full commit -m 'trigger-full'
   DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=4 * (glob)
   DBG-DELTAS: MANIFESTLOG: * (glob)