All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Simon.Cathebras" <Simon.Cathebras@ensimag.imag.fr>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>,
	git@vger.kernel.org, Charles Roussel <charles.roussel@ensimag.fr>,
	Simon Perrat <Simon.Perrat@ensimag.imag.fr>,
	Charles Roussel <Charles.Roussel@ensimag.imag.fr>,
	Julien Khayat <Julien.Khayat@ensimag.imag.fr>
Subject: Re: [PATCH 2/3] Test environment of git-remote-mw
Date: Fri, 01 Jun 2012 16:43:13 +0200	[thread overview]
Message-ID: <4FC8D501.20207@ensimag.imag.fr> (raw)
In-Reply-To: <vpqmx4n9rq6.fsf@bauges.imag.fr>

On 01/06/2012 13:49, Matthieu Moy wrote:
> Guillaume Sasdy<guillaume.sasdy@ensimag.imag.fr>  writes:
>
>>   # CONFIGURATION VARIABLES
>> -# You might want to change those ones ...
>> +# You might want to change these ones
>>   #
>>   WIKI_DIR_NAME="wiki"            # Name of the wiki's directory
>>   WIKI_DIR_INST="/var/www"        # Directory of the web server
>>   TMP="/tmp"                      # Temporary directory for downloads
>> -                                # Absolute address needed!
>> +                                # Absolute path required!
>>   SERVER_ADDR="localhost"         # Web server's address
>>
>> -#
>>   # CONFIGURATION
>> -# You should not change those ones unless you know what you to
>> +# You should not change these ones unless you know what you do
> I already mentionned in in your v1, but these fixups do not belong to
> PATCH 2/3. You do not want reviewers to see your mistakes in PATCH 1/2
> and see the fix in PATCH 2/3.
Got it. With the problem experienced yesterday, we had still this issue 
this morning. It is now fixed :).
>> +wiki_getpage () {
>> +	../test-gitmw.pl get_page -p "$1" "$2"
>> +}
> Any reason why test-gitmw.pl and wiki_getpage have this slightly
> different API? The perl version has a "-p" flag, and the shell command
> has only positionnal arguments.
The "-p" flag exists to specify if we have to use the admin login on 
wiki to do the command. For instance, here we fetch a page from the wiki 
with Admin privilege.
Others arguments remains the same.
> I'd rather have a more uniform way to wrap calls to test-gitmw.pl in
> shell, like
>
> wiki_<something>  () {
> 	../test-gitmw.pl<something>  "$@"
> }
Do you suggest we include the "-p" flag in <something> ?
I agree for the use of "$@".
>
> Then, you probably want to move the API documentation (i.e. comments you
> put before the shell functions) in, or next to the Perl script, and
> avoid repeating it in the shell.
>
Ok.
>> +# git_content<dir_1>  <dir_2>
>> +#
>> +# Compare the contents of directories<dir_1>  and<dir_2>  with diff
>> +# and exits with error 1 if they do not match. The program will
>> +# not look into .git in the process.
>> +git_content () {
> Didn't I already say that the naming was strange? A function that
> compares something shouldn't be called just "content".
Sorry, we misunderstood what you mean... Update is coming. What about 
git_diff_directories ?
Because this shell function execute a special instance of diff, matching 
two directories and ignoring blank character.
>> +	result=$(diff -r -b --exclude=".git" "$1" "$2")
>> +
>> +	if echo $result | grep -q ">" ; then
> Why grep, when the exit status of diff tells you about the differences
> already?
>
Good idea for the exit status.
>> +# git_exist<rep_name>  <file_name>
>> +#
>> +# Check the existence of<file_name>  into the git repository
>> +#<rep_name>  and exits with error 1 if it is absent.
>> +git_exist () {
>> +	result=$(find "$1" -type f -name "$2")
>> +
>> +	if ! echo $result | grep -q "$2" ; then
> Missing quotes around $result.
>
> Why do you need grep again? You just want to check whether "$result" is
> empty (test -z).
this function is now erased from our code... Actually, it was really 
useless...
>> +		echo "test failed: file $2 does not exist in $1"
>> +		exit 1
> die
>
> ?
>
>> +wiki_page_exist () {
>> +	wiki_getpage "$1" .
>> +
>> +	if test -f "$1".mw ; then
>> +		echo "test failed: file $1 not found on wiki"
>> +		exit 1
> likewise.
We were supposed to do it with the previous version.
But we are facing some difficulties using die function outside the test 
harness. We wanted to include the file "test-lib.sh" in our own script 
"test-gitmw-lib.sh" to use die. It doesn't work, because the harness 
expect the file "test-gitmw-lib.sh" to be a test script. Wich is not the 
case.

Do you have any Idea about how to fix this problem ?
>> +fail()
>> +{
> Style: fail () {
>
> Plus, didn't we say "die" was already there for this?
Agree, see above.
>> +        # Replace spaces by underscore in the page name
>> +	$pagename=~s/\ /_/;
> Indent with space (didn't I already mention that?).
>
>> +my $login = $ARGV[0];
>> +
>> +if ($login eq "-p")
> Feels weird. If you're not sure it's a login, why call the variable
> $login?
Change on the way. renaming this variable "is_login". Is this ok for you ?
> Any reason not to use Perl's option parsing?
Not at all, we juste didn't thought about it.

-- 
CATHEBRAS Simon

2A-ENSIMAG

Filière Ingéniérie des Systèmes d'Information
Membre Bug-Buster

  reply	other threads:[~2012-06-01 14:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 16:30 [PATCH/RFC]Test environment for Git-MediaWiki Simon.Cathebras
2012-05-30 17:04 ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Simon Cathebras
2012-05-30 17:04   ` [PATCH 2/3] Test environment of git-remote-mw Simon Cathebras
2012-05-31  7:17     ` Matthieu Moy
2012-06-01  8:53       ` Simon.Cathebras
2012-06-01  9:02         ` Matthieu Moy
2012-06-01  9:21           ` Matthieu Moy
2012-05-30 17:04   ` [PATCH 3/3] Tests file for git-remote-mediawiki Simon Cathebras
2012-05-31  7:19   ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Matthieu Moy
2012-05-31 18:13 ` [PATCH 1/2] FIX: t9360. NEW test t9361 for git pull and git push Guillaume Sasdy
2012-05-31 18:13   ` [PATCH 2/2] FIX: Syntax of shell and perl scripts and posix compliant Guillaume Sasdy
2012-05-31 18:16 ` [PATCH] " Guillaume Sasdy
2012-05-31 18:27 ` Guillaume Sasdy
2012-05-31 18:31 ` [PATCH 1/3] FIX: cmd_* moved to wiki_* in test-gitmw-lib.sh and other files Guillaume Sasdy
2012-06-01 10:41 ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Guillaume Sasdy
2012-06-01 10:41   ` [PATCH 2/3] Test environment of git-remote-mw Guillaume Sasdy
2012-06-01 11:49     ` Matthieu Moy
2012-06-01 14:43       ` Simon.Cathebras [this message]
2012-06-02 10:47         ` Matthieu Moy
2012-06-04 14:13           ` Simon.Cathebras
2012-06-01 10:41   ` [PATCH 3/3] Tests file for git-remote-mediawiki Guillaume Sasdy
  -- strict thread matches above, loose matches on Subject: below --
2012-06-05 13:20 [Git-MediaWiki] Test environment for Git-MediaWiki Simon.Cathebras
2012-06-05 13:25 ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Simon Cathebras
2012-06-05 13:25   ` [PATCH 2/3] Test environment of git-remote-mw Simon Cathebras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FC8D501.20207@ensimag.imag.fr \
    --to=simon.cathebras@ensimag.imag.fr \
    --cc=Charles.Roussel@ensimag.imag.fr \
    --cc=Julien.Khayat@ensimag.imag.fr \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=Simon.Perrat@ensimag.imag.fr \
    --cc=charles.roussel@ensimag.fr \
    --cc=git@vger.kernel.org \
    --cc=guillaume.sasdy@ensimag.imag.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.