* [PATCH] t9020: use configured Python to run test helper
@ 2012-12-19 4:49 Junio C Hamano
2012-12-19 13:15 ` Pete Wyckoff
0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2012-12-19 4:49 UTC (permalink / raw)
To: git
The test helper svnrdump_sim.py is used as "svnrdump" during the
execution of this test, but the arrangement had a few undesirable
things:
- it relied on symbolic links;
- unportable "export VAR=VAL" was used;
- GIT_BUILD_DIR variable was not quoted correctly;
- it assumed that the Python interpreter is in /usr/bin/ and
called "python" (i.e. not "python2.7" etc.)
Rework this by writing a small shell script that spawns the right
Python interpreter, using the right quoting.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* The analysis above counts more bugs than the number of lines that
are deleted in this section of the code...
t/t9020-remote-svn.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh
index 4f2dfe0..d7be66a 100755
--- a/t/t9020-remote-svn.sh
+++ b/t/t9020-remote-svn.sh
@@ -12,9 +12,13 @@ then
test_done
fi
-# We override svnrdump by placing a symlink to the svnrdump-emulator in .
-export PATH="$HOME:$PATH"
-ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py "$HOME/svnrdump"
+# Override svnrdump with our simulator
+PATH="$HOME:$PATH"
+export PATH PYTHON_PATH GIT_BUILD_DIR
+
+write_script "$HOME/svnrdump" <<\EOF
+exec "$PYTHON_PATH" "$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py" "$@"
+EOF
init_git () {
rm -fr .git &&
--
1.8.1.rc2.196.g90926c8
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] t9020: use configured Python to run test helper
2012-12-19 4:49 [PATCH] t9020: use configured Python to run test helper Junio C Hamano
@ 2012-12-19 13:15 ` Pete Wyckoff
0 siblings, 0 replies; 2+ messages in thread
From: Pete Wyckoff @ 2012-12-19 13:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
gitster@pobox.com wrote on Tue, 18 Dec 2012 20:49 -0800:
> The test helper svnrdump_sim.py is used as "svnrdump" during the
> execution of this test, but the arrangement had a few undesirable
> things:
>
> - it relied on symbolic links;
> - unportable "export VAR=VAL" was used;
> - GIT_BUILD_DIR variable was not quoted correctly;
> - it assumed that the Python interpreter is in /usr/bin/ and
> called "python" (i.e. not "python2.7" etc.)
>
> Rework this by writing a small shell script that spawns the right
> Python interpreter, using the right quoting.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>
> * The analysis above counts more bugs than the number of lines that
> are deleted in this section of the code...
>
> t/t9020-remote-svn.sh | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/t/t9020-remote-svn.sh b/t/t9020-remote-svn.sh
> index 4f2dfe0..d7be66a 100755
> --- a/t/t9020-remote-svn.sh
> +++ b/t/t9020-remote-svn.sh
> @@ -12,9 +12,13 @@ then
> test_done
> fi
>
> -# We override svnrdump by placing a symlink to the svnrdump-emulator in .
> -export PATH="$HOME:$PATH"
> -ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py "$HOME/svnrdump"
> +# Override svnrdump with our simulator
> +PATH="$HOME:$PATH"
> +export PATH PYTHON_PATH GIT_BUILD_DIR
> +
> +write_script "$HOME/svnrdump" <<\EOF
> +exec "$PYTHON_PATH" "$GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py" "$@"
> +EOF
You don't really need to export PYTHON_PATH and GIT_BUILD_DIR if
you get them expanded in the svnrdump script wrapper. Unquote
the EOF but add \ for $@.
Either way it's a nice improvement, especially with the
bugs/lines metric being >1.
-- Pete
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-19 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19 4:49 [PATCH] t9020: use configured Python to run test helper Junio C Hamano
2012-12-19 13:15 ` Pete Wyckoff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).