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

From:
Omar Polo <op@omarpolo.com>
Subject:
regress: strip trailing / from -r tmpdir
To:
gameoftrees@openbsd.org
Date:
Tue, 10 Jan 2023 12:41:32 +0100

Download raw body.

Thread
One midly annoying thing when manually running some test cases is that
you need to remember to remove the trailing / from the path given as -r:

	% ./diff -r ~/tmp/got-tmp
	everything's ok
	% ./diff -r ~/tmp/got-tmp/
	most tests fails because they expect
	~/tmp/got-tmp/foo instead of
	~/tmp/got-tmp//foo ...

this is just to scratch an itch.  given that the shell' tab-completion
adds a trailing / for directories, what not stripping it?

ok?

diff /home/op/w/got
commit - 34d80a0ff3357761ddb975a1a96d3ee795218e41
path + /home/op/w/got
blob - 09788e37096319afffa06cca64d7a215c112d476
file + regress/cmdline/common.sh
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -231,7 +231,7 @@ test_parseargs()
 		case $flag in
 		q)	export GOT_TEST_QUIET=1
 			;;
-		r)	export GOT_TEST_ROOT=$OPTARG
+		r)	export GOT_TEST_ROOT=${OPTARG%/}
 			;;
 		?)	echo "Supported options:"
 			echo "  -q: quiet mode"