"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Lucas <lucas@sexy.is>
Subject:
Replace jot in regress
To:
gameoftrees@openbsd.org
Date:
Tue, 21 Sep 2021 04:31:12 +0000

Download raw body.

Thread
Hello,

Find a patch providing a replacement for `jot`, which should aid in
running regress under Linux. While there, I converted to obvious cases
of `echo 1; echo 2; echo 3; ...` to the new function.

I only tested this fully under OpenBSD. I tested it lightly on Linux and
I don't have access to a FreeBSD system and sadly vmd can't run it. On
OpenBSD, only failure, which I also face running without this patch, is:

==== histedit ====
./histedit.sh -q -r "/home/lucas/code/git/git.gameoftrees.org/got-test-root/got-test.cr5YVj68IG"
--- /home/lucas/code/git/git.gameoftrees.org/got-test-root/got-test.cr5YVj68IG/got-test-histedit_no_op-77iNHu1m/stdout.expected Tue Sep 21 03:57:49 2021
+++ /home/lucas/code/git/git.gameoftrees.org/got-test-root/got-test.cr5YVj68IG/got-test-histedit_no_op-77iNHu1m/stdout  Tue Sep 21 03:57:49 2021
@@ -7,5 +7,3 @@
  
 has become commit a7f05202bdc51c8f3a225be3e4d89fea313ebb6a (master)
  2021-09-21 flan_hacker  committing to zeta on master
-history forked at 98316d0a9092e0817b44bace2ee78be726a649f6
- 2021-09-21 flan_hacker  adding the test tree
test failed; leaving test data in /home/lucas/code/git/git.gameoftrees.org/got-test-root/got-test.cr5YVj68IG/got-test-histedit_no_op-77iNHu1m

On Linux, the only non-strerror-related failures are

--- /tmp/got-test-histedit_no_op-ejXE1yFI/stdout.expected       2021-09-21 04:27:45.137403006 +0000
+++ /tmp/got-test-histedit_no_op-ejXE1yFI/stdout        2021-09-21 04:27:45.130402405 +0000
@@ -7,5 +7,5 @@
  
 has become commit 70dc5e53ef5de1a665a464b314052a6a834d3bdf (master)
  2021-09-21 flan_hacker  committing to zeta on master
-history forked at c0da20980a34bf4d07ff46d652c02f4d96b55a08
- 2021-09-21 flan_hacker  adding the test tree
+history forked at 0862fd9c1ca3627316e3934cd9681191e1a4f2d1
+ 2021-09-21 flan_hacker  committing changes
test failed; leaving test data in /tmp/got-test-histedit_no_op-ejXE1yFI
--- /tmp/got-test-import_basic-j5tUtP9C/stdout.expected 2021-09-21 04:27:46.725539328 +0000
+++ /tmp/got-test-import_basic-j5tUtP9C/stdout  2021-09-21 04:27:46.723539156 +0000
@@ -1,5 +1,5 @@
-A  /tmp/got-test-import_basic-j5tUtP9C/tree/gamma/delta
 A  /tmp/got-test-import_basic-j5tUtP9C/tree/epsilon/zeta
+A  /tmp/got-test-import_basic-j5tUtP9C/tree/gamma/delta
 A  /tmp/got-test-import_basic-j5tUtP9C/tree/alpha
 A  /tmp/got-test-import_basic-j5tUtP9C/tree/beta
 Created branch refs/heads/main with commit c8d07174c9d406d8c10db6841335ccf73e900b2a
test failed; leaving test data in /tmp/got-test-import_basic-j5tUtP9C

Comments?

-Lucas

diff refs/heads/main refs/heads/dont-use-jot
blob - a9916124c369cb2ba1bac4634cd2e80573716a5a
blob + e041544b4b38c59af3471bb72a50f32bf86ca4e5
--- regress/cmdline/blame.sh
+++ regress/cmdline/blame.sh
@@ -205,7 +205,7 @@ test_blame_all_lines_replaced() {
 		return 1
 	fi
 
-	jot 8 > $testroot/wt/alpha
+	pjot 8 > $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m "change 1" > /dev/null)
 	local commit1=`git_show_head $testroot/repo`
 	local short_commit1=`trim_obj_id 32 $commit1`
@@ -242,7 +242,7 @@ test_blame_lines_shifted_up() {
 		return 1
 	fi
 
-	jot 8 > $testroot/wt/alpha
+	pjot 8 > $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m "change 1" > /dev/null)
 	local commit1=`git_show_head $testroot/repo`
 	local short_commit1=`trim_obj_id 32 $commit1`
@@ -253,11 +253,11 @@ test_blame_lines_shifted_up() {
 	local commit2=`git_show_head $testroot/repo`
 	local short_commit2=`trim_obj_id 32 $commit2`
 
-	jot 2 > $testroot/wt/alpha
+	pjot 2 > $testroot/wt/alpha
 	echo foo >> $testroot/wt/alpha
 	echo bar >> $testroot/wt/alpha
 	echo baz >> $testroot/wt/alpha
-	jot 8 6 8 1 >> $testroot/wt/alpha
+	pjot 6 8 >> $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m "change 3" > /dev/null)
 	local commit3=`git_show_head $testroot/repo`
 	local short_commit3=`trim_obj_id 32 $commit3`
@@ -298,7 +298,7 @@ test_blame_lines_shifted_down() {
 		return 1
 	fi
 
-	jot 8 > $testroot/wt/alpha
+	pjot 8 > $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m "change 1" > /dev/null)
 	local commit1=`git_show_head $testroot/repo`
 	local short_commit1=`trim_obj_id 32 $commit1`
@@ -309,11 +309,11 @@ test_blame_lines_shifted_down() {
 	local commit2=`git_show_head $testroot/repo`
 	local short_commit2=`trim_obj_id 32 $commit2`
 
-	jot 2 > $testroot/wt/alpha
+	pjot 2 > $testroot/wt/alpha
 	echo foo >> $testroot/wt/alpha
 	echo bar >> $testroot/wt/alpha
 	echo baz >> $testroot/wt/alpha
-	jot 8 3 8 1 >> $testroot/wt/alpha
+	pjot 3 8 >> $testroot/wt/alpha
 	(cd $testroot/wt && got commit -m "change 3" > /dev/null)
 	local commit3=`git_show_head $testroot/repo`
 	local short_commit3=`trim_obj_id 32 $commit3`
blob - 260f6406dd2eba1355d668e2c054b7f09f9f1ee5
blob + f6cce9686d3d9bd9d22bbfc535f0fa7c1117bf2a
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -256,3 +256,36 @@ test_done()
 		echo "test failed; leaving test data in $testroot"
 	fi
 }
+
+# Portable, jot-like utility. Limitations:
+# - only integers operations supported
+# - only positive stepsize
+# - no type-checks on arguments
+# - `echo $n` might not work correctly with negative numbers, but
+#   `printf "%d\n" $n` makes `make regress` go from ~3min20sec to
+#   ~4min0sec on my machine.
+# Usage:
+#	pjot E		print numbers from 1 to E, stepsize 1
+#	pjot B E	print numbers from B to E, stepsize 1
+#	pjot B E S	print numbers from B to E, stepsize S
+pjot()
+{
+	local begin=1 stepsize=1 end n
+
+	case $# in
+	1)	end=$1 ;;
+	2)	begin=$1 end=$2 ;;
+	3)	begin=$1 end=$2 stepsize=$3 ;;
+	*)	return 1 ;;
+	esac
+
+	if [ $stepsize -le 0 ] || [ $begin -gt $end ]; then
+		return 1
+	fi
+
+	n=$begin
+	while [ $n -le $end ]; do
+		echo $n
+		n=$((n + stepsize))
+	done
+}
blob - 5d259e7e69fb72c30e2d546a71895f1edb136f69
blob + 6b9ae241240bec4d3ae8e80ea17400e7fcb8cbad
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
@@ -92,14 +92,7 @@ test_diff_basic() {
 test_diff_shows_conflict() {
 	local testroot=`test_init diff_shows_conflict 1`
 
-	echo "1" > $testroot/repo/numbers
-	echo "2" >> $testroot/repo/numbers
-	echo "3" >> $testroot/repo/numbers
-	echo "4" >> $testroot/repo/numbers
-	echo "5" >> $testroot/repo/numbers
-	echo "6" >> $testroot/repo/numbers
-	echo "7" >> $testroot/repo/numbers
-	echo "8" >> $testroot/repo/numbers
+	pjot 8 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local base_commit=`git_show_head $testroot/repo`
blob - 9766243def1b9ea970812bb138d4d8aeda056a96
blob + 3c765d38370268b9061455ab965bb92e80b86dfe
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
@@ -372,7 +372,7 @@ test_revert_directory_unknown() {
 test_revert_patch() {
 	local testroot=`test_init revert_patch`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local commit_id=`git_show_head $testroot/repo`
@@ -845,7 +845,7 @@ test_revert_patch_removed() {
 test_revert_patch_one_change() {
 	local testroot=`test_init revert_patch_one_change`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local commit_id=`git_show_head $testroot/repo`
blob - 8e7009b68305bcecb73914412de27d91708eb4ef
blob + e95d3ae07966997e91f7792de94d47ebd3bbccb4
--- regress/cmdline/stage.sh
+++ regress/cmdline/stage.sh
@@ -1432,7 +1432,7 @@ test_stage_commit() {
 test_stage_patch() {
 	local testroot=`test_init stage_patch`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local commit_id=`git_show_head $testroot/repo`
@@ -1717,7 +1717,7 @@ EOF
 test_stage_patch_twice() {
 	local testroot=`test_init stage_patch_twice`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local commit_id=`git_show_head $testroot/repo`
@@ -2154,7 +2154,7 @@ test_stage_patch_removed_twice() {
 test_stage_patch_quit() {
 	local testroot=`test_init stage_patch_quit`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	echo zzz > $testroot/repo/zzz
 	(cd $testroot/repo && git add numbers zzz)
 	git_commit $testroot/repo -m "added files"
@@ -2262,7 +2262,7 @@ EOF
 test_stage_patch_incomplete_script() {
 	local testroot=`test_init stage_incomplete_script`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	echo zzz > $testroot/repo/zzz
 	(cd $testroot/repo && git add numbers zzz)
 	git_commit $testroot/repo -m "added files"
blob - de94a6e129b914a487c98dde2b1cc0d59698c4cd
blob + 40e85ded8ba5b13faad99f066bb284a3a10f0ba5
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
@@ -159,14 +159,7 @@ test_status_obstructed() {
 test_status_shows_local_mods_after_update() {
 	local testroot=`test_init status_shows_local_mods_after_update 1`
 
-	echo "1" > $testroot/repo/numbers
-	echo "2" >> $testroot/repo/numbers
-	echo "3" >> $testroot/repo/numbers
-	echo "4" >> $testroot/repo/numbers
-	echo "5" >> $testroot/repo/numbers
-	echo "6" >> $testroot/repo/numbers
-	echo "7" >> $testroot/repo/numbers
-	echo "8" >> $testroot/repo/numbers
+	pjot 8 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 
@@ -320,10 +313,7 @@ test_status_shows_no_mods_after_complete_merge() {
 	local testroot=`test_init status_shows_no_mods_after_complete_merge 1`
 
 	# make this file larger than the usual blob buffer size of 8192
-	echo -n > $testroot/repo/numbers
-	for i in `jot 16384`; do
-		echo "$i" >> $testroot/repo/numbers
-	done
+	pjot 16384 > $testroot/repo/numbers
 
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
@@ -372,14 +362,7 @@ test_status_shows_no_mods_after_complete_merge() {
 test_status_shows_conflict() {
 	local testroot=`test_init status_shows_conflict 1`
 
-	echo "1" > $testroot/repo/numbers
-	echo "2" >> $testroot/repo/numbers
-	echo "3" >> $testroot/repo/numbers
-	echo "4" >> $testroot/repo/numbers
-	echo "5" >> $testroot/repo/numbers
-	echo "6" >> $testroot/repo/numbers
-	echo "7" >> $testroot/repo/numbers
-	echo "8" >> $testroot/repo/numbers
+	pjot 8 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 
blob - 053325225ecc1c55962ba876ee2610f161762fa3
blob + 221761a0f3558827ca847a10feaf60b4c7286bfd
--- regress/cmdline/unstage.sh
+++ regress/cmdline/unstage.sh
@@ -186,7 +186,7 @@ test_unstage_nonexistent() {
 test_unstage_patch() {
 	local testroot=`test_init unstage_patch`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local commit_id=`git_show_head $testroot/repo`
@@ -805,7 +805,7 @@ test_unstage_patch_removed() {
 test_unstage_patch_quit() {
 	local testroot=`test_init unstage_patch_quit`
 
-	jot 16 > $testroot/repo/numbers
+	pjot 16 > $testroot/repo/numbers
 	echo zzz > $testroot/repo/zzz
 	(cd $testroot/repo && git add numbers zzz)
 	git_commit $testroot/repo -m "added files"
blob - cae602420f097ed69b049e9fffb3fc46510d2de5
blob + 7c18e182b112938629ef6f9eee5fd1e225350d49
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
@@ -639,14 +639,7 @@ test_update_file_in_subsubdir() {
 test_update_merges_file_edits() {
 	local testroot=`test_init update_merges_file_edits`
 
-	echo "1" > $testroot/repo/numbers
-	echo "2" >> $testroot/repo/numbers
-	echo "3" >> $testroot/repo/numbers
-	echo "4" >> $testroot/repo/numbers
-	echo "5" >> $testroot/repo/numbers
-	echo "6" >> $testroot/repo/numbers
-	echo "7" >> $testroot/repo/numbers
-	echo "8" >> $testroot/repo/numbers
+	pjot 8 > $testroot/repo/numbers
 	(cd $testroot/repo && git add numbers)
 	git_commit $testroot/repo -m "added numbers file"
 	local base_commit=`git_show_head $testroot/repo`