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

Re: [PATCH 3/9] git p4 test: simplify quoting involving TRASH_DIRECTORY

From
PWPete Wyckoff <pw@padd.com>
Date
Jun 26, 2012, 17:10 UTC
Message-ID
<20120626171053.GA31456@padd.com>
In-Reply-To
<7vk3yuca42.fsf@alter.siamese.dyndns.org>
gitster@pobox.com wrote on Tue, 26 Jun 2012 09:26 -0700:
Show 43 quoted lines
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
> > Am 6/26/2012 3:18, schrieb Pete Wyckoff:
> >>  test_expect_success 'exit when p4 fails to produce marshaled output' '
> >> -	badp4dir="$TRASH_DIRECTORY/badp4dir" &&
> >> -	mkdir "$badp4dir" &&
> >> -	test_when_finished "rm \"$badp4dir/p4\" && rmdir \"$badp4dir\"" &&
> >> -	cat >"$badp4dir"/p4 <<-EOF &&
> >> +	mkdir badp4dir &&
> >> +	test_when_finished "rm badp4dir/p4 && rmdir badp4dir" &&
> >> +	cat >badp4dir/p4 <<-EOF &&
> >>  	#!$SHELL_PATH
> >>  	exit 1
> >>  	EOF
> >> -	chmod 755 "$badp4dir"/p4 &&
> >> -	PATH="$badp4dir:$PATH" git p4 clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
> >> +	chmod 755 badp4dir/p4 &&
> >> +	PATH="$TRASH_DIRECTORY/badp4dir:$PATH" git p4 clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
> >>  	test $retval -eq 1 &&
> >
> > The long line here is severly broken, because the semicolon breaks the &&
> > chain; retval would be assigned to even if one of the earlier commands
> > fails, and that you don't want to treat as success. The least that is
> > needed is to put the line in braces. But I suggest to rewrite the two
> > lines above as
> >
> > 	(
> > 		PATH="$TRASH_DIRECTORY/badp4dir:$PATH" &&
> > 		export PATH &&
> > 		test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1
> > 	) &&
> >
> >>  	test_must_fail grep -q Traceback errs
> >
> > We don't expect that grep fails due to segfault or something. Write this
> > line as
> >
> > 	! grep Traceback errs
> >
> > Also drop the -q; if the test detects a failure, you do want to see the
> > grep output in a verbose test run.
> 
> All true.  Thanks for carefully reading.

Yes, both your reviews are quite appreciated. I've got patches ready for these and will plan to send out an updated series tonight.

		-- Pete
Previous: Junio C HamanoNext: Pete Wyckoff
Message 8 of 14 in “git p4 test fixes”
  1. 0/9 git p4 test fixesPete Wyckoff, Jun 26, 2012
  2. 1/9 git p4 test: wait longer for p4d to startPete Wyckoff, Jun 26, 2012
  3. Junio C HamanoJun 26, 2012
  4. 2/9 git p4 test: use real_path to resolve p4 client symlinksPete Wyckoff, Jun 26, 2012
  5. 3/9 git p4 test: simplify quoting involving TRASH_DIRECTORYPete Wyckoff, Jun 26, 2012
  6. Johannes SixtJun 26, 2012
  7. Junio C HamanoJun 26, 2012
  8. Pete WyckoffJun 26, 2012
  9. 4/9 git p4 test: never create default test repoPete Wyckoff, Jun 26, 2012
  10. 5/9 git p4 test: rename some "git-p4 command" stringsPete Wyckoff, Jun 26, 2012
  11. 6/9 git p4 test: check for error message in failed testPete Wyckoff, Jun 26, 2012
  12. 7/9 git p4 test: copy source indeterminatePete Wyckoff, Jun 26, 2012
  13. 8/9 git p4 test: cleanup_git should make a new $gitPete Wyckoff, Jun 26, 2012
  14. 9/9 git p4 test: split up big t9800 testPete Wyckoff, Jun 26, 2012

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.