Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--filter + --loop = fail #15

Open
Hywan opened this issue Mar 3, 2015 · 7 comments
Open

--filter + --loop = fail #15

Hywan opened this issue Mar 3, 2015 · 7 comments

Comments

@Hywan
Copy link
Member

Hywan commented Mar 3, 2015

Do you reproduce?

@jubianchi
Copy link
Member

@Hywan can you describe the fail you get?

@Hywan
Copy link
Member Author

Hywan commented Mar 3, 2015

An error in the ruler-extension.

@agallou
Copy link
Member

agallou commented Mar 3, 2015

When I take this test (https://gist.github.com/agallou/67835a4181b077e32220) on this gist with the filter I get this error :

Error: Context reference \test1\\ does not exists.

when I launch this command :

./vendor/bin/atoum toto_test.php --loop  --filter "'test1' in tags"

(that works withtout the --loop option)

I will look into it.

@agallou
Copy link
Member

agallou commented Mar 3, 2015

The rule seems to be escaped when using the loop option.
Here is it's value without the loop option : 'test1' in tags
And it's value with the loop option : \test1\\ in tags

@agallou
Copy link
Member

agallou commented Mar 3, 2015

seems to be a problem in the toString method of the cli class : https://github.com/atoum/atoum/blob/master/classes/cli/command.php#L31

When removing the escaping in vendor/atoum/atoum/classes/cli/command.php

44d43
< 
57c56
<                                       $command .= ' ' . escapeshellarg($value);
---
>                                       $command .= sprintf(' "%s"', $value);
68c67
<                       $command = escapeshellcmd($this->binaryPath . $command);
---
>                       $command = $this->binaryPath . $command;
70d68
< 

the loop mode works in conjuction with the ruler extension.

I'll try to find a better fix.

@Hywan
Copy link
Member Author

Hywan commented Mar 4, 2015

@agallou Good! Maybe @mageekguy could help on this one?

@jubianchi
Copy link
Member

@Hywan @agallou you should look at this: https://github.com/atoum/atoum/blob/d361021cc7a0448f2e609e2357f668b50d9bd3b8/classes/scripts/runner.php#L1200 and also in the php class which handles launching php commands.

agallou added a commit to agallou/atoum that referenced this issue Mar 5, 2015
When the ruler-extension with the loop mode was runned and the filter argument had a single quote, this error occurs :
```
Error: Context reference \test1\\ does not exists.
```

cf atoum/ruler-extension#15

This occurs because there was too much escaping when running the loop mode :

```
/usr/bin/php5 -f ./vendor/bin/atoum -- --disable-loop-mode --force-terminal -f 'toto_test.php' --filter ''\\''test1'\\'' in tags' --score-file '/tmp/atoum.score'
```

Now the command launched by the loop mode is properly escaped :
```
/usr/bin/php5 -f ./vendor/bin/atoum -- --disable-loop-mode --force-terminal -f 'toto_test.php' --filter ''\''test1'\'' in tags' --score-file '/tmp/atoum.score'
```
agallou added a commit to agallou/atoum that referenced this issue May 8, 2016
When the ruler-extension with the loop mode was runned and the filter argument had a single quote, this error occurs :
```
Error: Context reference \test1\\ does not exists.
```

cf atoum/ruler-extension#15

This occurs because there was too much escaping when running the loop mode :

```
/usr/bin/php5 -f ./vendor/bin/atoum -- --disable-loop-mode --force-terminal -f 'toto_test.php' --filter ''\\''test1'\\'' in tags' --score-file '/tmp/atoum.score'
```

Now the command launched by the loop mode is properly escaped :
```
/usr/bin/php5 -f ./vendor/bin/atoum -- --disable-loop-mode --force-terminal -f 'toto_test.php' --filter ''\''test1'\'' in tags' --score-file '/tmp/atoum.score'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants