Download raw body.
[rfc] regress: add line number to failure output
On 2023/02/16 10:15:51 +0100, Stefan Sperling <stsp@stsp.name> wrote: > On Thu, Feb 16, 2023 at 07:57:11PM +1100, Mark Jamsek wrote: > > I had a little look to try accomplish this without passing $LINENO to > > test_done() everywhere but came up empty :( > > > > But, then I thought, for those older systems that don't have LINENO, > > could we just keep our current output, and only print op's suggested > > $filename.sh:$LINENO if it is supported? > > > > That way, only meaningful information will be reported where it can, > > with no change otherwise. > > > > It probably feels like more of a boon than it is because both op and > > I have lately had relevant situations where it is indeed useful, but > > I'd also hazard a guess that they won't be the last :) > > > > OTOH, it's a lot of $LINENO! > > I am wondering why I never saw a need for this myself. > > I do sometimes add 'set -x' into test functions in stragic places to see > a trace of the commands being run along with the test failure. Once I > have managed to fix a test I remove its 'set -x' lines again. > Does that solve the same problem? have to admit i completely forgot about set -x. furthermore the case i was referring to was a bit unusual, with lots of tests breaking just because there was something to tweak in that codepath that was almost always independent of the overall environment that the test was reproducing. rethinking about this, i still think it'd be nice but maybe it's just too much churn. Trying to keep different error messages in the various failure point of a test case is likely enough. > I also often comment out tests in the long list at the bottom of > the file in order to run a single test case. I wish there was a > better solution but so far as it has not bothered me too much. same thing. something like this should do it. % ./cleanup.sh test_cleanup_unreferenced_loose_objects ok test_cleanup_redundant_loose_objects ok test_cleanup_precious_objects ok test_cleanup_missing_pack_file ok % ./cleanup.sh test_cleanup_missing_pack_file test_cleanup_precious_objects test_cleanup_precious_objects ok test_cleanup_missing_pack_file ok diff /home/op/w/gotd commit - 0e0165f13a58bad062d9761626c1b3ba82df671c path + /home/op/w/gotd blob - 96339d43615d5d8fad7e4a300f64c7db2dc9cea8 file + regress/cmdline/common.sh --- regress/cmdline/common.sh +++ regress/cmdline/common.sh @@ -14,6 +14,8 @@ export GIT_AUTHOR_NAME="Flan Hacker" # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +regress_run_only="" + export GIT_AUTHOR_NAME="Flan Hacker" export GIT_AUTHOR_EMAIL="flan_hacker@openbsd.org" export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" @@ -241,11 +243,21 @@ test_parseargs() ;; esac done + shift $(($OPTIND - 1)) + regress_run_only="$@" } >&2 run_test() { testfunc="$1" + + if [ -n "$regress_run_only" ]; then + case "$regress_run_only" in + *$testfunc*) ;; + *) return ;; + esac + fi + if [ -z "$GOT_TEST_QUIET" ]; then echo -n "$testfunc " fi
[rfc] regress: add line number to failure output