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

[PATCH] git_mkstemps: improve test suite test

From
Dale R. Worley <worley@alum.mit.edu>
Date
Aug 3, 2013, 00:27 UTC
Message-ID
<201308030027.r730RNWS022924@freeze.ariadne.com>

Commit 52749 fixes a bug regarding testing the return of an open() call for success/failure. Improve the testsuite test for that fix by removing the helper program 'test-close-fd-0' and replacing it with the shell redirection '<&-'. (The redirection is Posix, so it should be portable.)

Signed-off-by: Dale Worley <worley@ariadne.com>
---
Show 5 quoted lines
> From: Junio C Hamano <gitster@pobox.com>
> Date: Fri, 19 Jul 2013 07:29:47 -0700
> 
> The change itself looks good; care to write it up as a proper patch
> with a proposed log message?

My apologies for the delay; I've had to do some yak-shaving to learn how to construct patches properly. (I've written some clarifications for Document/SubmittingPatches, which I will submit separately.)

Someone has gone ahead and made the code change, so all that remains is to update the testsuite test by replacing the helper program 'test-close-fd-0' with the Posix shell redirection '<&-'.

Dale
 Makefile          |    1 -
 test-close-fd-0.c |   14 --------------
 2 files changed, 0 insertions(+), 15 deletions(-)
 delete mode 100644 test-close-fd-0.c
diff --git a/Makefile b/Makefile
index 8ad40d4..3588ca1 100644
--- a/Makefile
+++ b/Makefile
@@ -557,7 +557,6 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_PROGRAMS_NEED_X += test-chmtime
-TEST_PROGRAMS_NEED_X += test-close-fd-0
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-date
 TEST_PROGRAMS_NEED_X += test-delta
diff --git a/test-close-fd-0.c b/test-close-fd-0.c
deleted file mode 100644
index 3745c34..0000000
--- a/test-close-fd-0.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <unistd.h>
-
-/* Close file descriptor 0 (which is standard-input), then execute the
- * remainder of the command line as a command. */
-
-int main(int argc, char **argv)
-{
-	/* Close fd 0. */
-	close(0);
-	/* Execute the requested command. */
-	execvp(argv[1], &argv[1]);
-	/* If execve() failed, return an error. */
-	return 1;
-}
-- 
1.7.7.6
Next: Jonathan Nieder
Message 1 of 4 in “git_mkstemps: improve test suite test”
  1. git_mkstemps: improve test suite testDale R. Worley, Aug 3, 2013
  2. Jonathan NiederAug 3, 2013
  3. Junio C HamanoAug 5, 2013
  4. Junio C HamanoAug 5, 2013

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.