Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Lock] fix locale dependent test case #27755

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

Merged
merged 1 commit into from
Jun 29, 2018

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 3.4
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Right now, I get a failure with Exception: Failed to extract list of opend semaphores. Expect a Semaphore status, got ------ États des sémaphores -------- :)

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still failing on OSX though

ipcs: illegal option -- u
ipcs: usage: ipcs [-abcmopqstMQST]

man says

A portable application shall not use the -a, -b, -o, -l, and -u options

@nicolas-grekas
Copy link
Member Author

should be fixed by an OSX user : )

@ogizanagi
Copy link
Contributor

On OS X, ipcs -s output looks like:

IPC status from <running system> as of Fri Jun 29 17:43:01 CEST 2018
T     ID     KEY        MODE       OWNER    GROUP
Semaphores:

followed by a list of active semaphores.

So a patch for OS X could be:

diff --git a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php
index 7057505..fb42e5a 100644
--- a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php
+++ b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php
@@ -50,6 +50,14 @@ class SemaphoreStoreTest extends AbstractStoreTest
 
     private function getOpenedSemaphores()
     {
+        if ('Darwin' === PHP_OS) {
+            $lines = explode(PHP_EOL, trim(`ipcs -s`));
+            if (-1 === $start = array_search('Semaphores:', $lines)) {
+                throw new \Exception('Failed to extract list of opend semaphores. Expect a Semaphore list, got '.implode(PHP_EOL, $lines));
+            }
+            return \count(\array_slice($lines, ++$start));
+        }
+
         $lines = explode(PHP_EOL, trim(`LC_ALL=C ipcs -su`));
         if ('------ Semaphore Status --------' !== $lines[0]) {
             throw new \Exception('Failed to extract list of opend semaphores. Expect a Semaphore status, got '.implode(PHP_EOL, $lines));

@nicolas-grekas nicolas-grekas merged commit e665da0 into symfony:3.4 Jun 29, 2018
nicolas-grekas added a commit that referenced this pull request Jun 29, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[Lock] fix locale dependent test case

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Right now, I get a failure with `Exception: Failed to extract list of opend semaphores. Expect a Semaphore status, got ------ États des sémaphores --------` :)

Commits
-------

e665da0 [Lock] fix locale dependent test case
@nicolas-grekas
Copy link
Member Author

@ogizanagi PR welcome, the commit should be for you :)

@nicolas-grekas nicolas-grekas deleted the lock-locale branch June 29, 2018 16:26
nicolas-grekas added a commit that referenced this pull request Jun 29, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[Lock] Fix SemaphoreStoreTest on OS X

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27755 (review)   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

As spotted in #27755 (review), for OS X.

If other OS X users could give it a try (`/phpunit src/Symfony/Component/Lock/ --filter=SemaphoreStoreTest`), that would be awesome.

Commits
-------

9055611 [Lock] Fix SemaphoreStoreTest on OS X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants