Skip to content

Commit

Permalink
tests: TEMP_DIR creation is based on PID (reverts ed9da2)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 25, 2013
1 parent c07074c commit 0e23c0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/Nette/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


// create temporary directory
define('TEMP_DIR', __DIR__ . '/../tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
define('TEMP_DIR', __DIR__ . '/../tmp/' . getmypid());
Tester\Helpers::purge(TEMP_DIR);


Expand Down
2 changes: 2 additions & 0 deletions tests/RunTests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ IF NOT EXIST %testRunner% (
SET phpIni="%~dp0php.ini-win"

php.exe -c %phpIni% %testRunner% -p php-cgi.exe -c %phpIni% -j 20 -log "%~dp0test.log" %*

rmdir "%~dp0/tmp" /S /Q

15 comments on commit 0e23c0a

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 25, 2013

Choose a reason for hiding this comment

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

What was wrong with the old behaviour? Maybe I don't understand because I was thinking $_SERVER['argv'] is set anytime.

@kolinger
Copy link

Choose a reason for hiding this comment

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

Yes (when accessing script via CLI or GET), but getmypid() is simpler and IMHO better :)

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

In coding, yes. But result is infinite set of directories (well, thousand of them) and $_SERVER['argv'] set is count of run tests. In first case you must care about deleting them, int the second case you don't.

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

Btw. I agree with commit, it is simpler to understand it. I was just interested why.

@kolinger
Copy link

Choose a reason for hiding this comment

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

On my machine (win, php 5.3) is count same for both (max 500). Only names are different (hashes vs. numbers).

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

Run it multiple times without RunTests.bat.

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

... we can discuss on forum if you want.

@dg
Copy link
Member Author

@dg dg commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

Travis runs tests for each PHP version simultaneously, using the same temp dir.

@enumag
Copy link
Contributor

@enumag enumag commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

@dg: Was that the reason why RecursiveDirectoryIterator often failed in travis tests?

@dg
Copy link
Member Author

@dg dg commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

I think so.

@enumag
Copy link
Contributor

@enumag enumag commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

OK. :-) We shall see.

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 26, 2013

Choose a reason for hiding this comment

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

I don't think so. The first line of log is a worker name. Different for every PHP version tests. And clonning of repo is done twice. But documentation is silent to this topic. Moreover RecursiveDirectoryIterator screams about TEMP_DIR directly and it is not deleted anytime.

@dg
Copy link
Member Author

@dg dg commented on 0e23c0a Feb 27, 2013

Choose a reason for hiding this comment

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

Your commit in Tester will explain it.

@dg
Copy link
Member Author

@dg dg commented on 0e23c0a Feb 27, 2013

Choose a reason for hiding this comment

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

WTF, „Error: mkdir(): File exists“ https://travis-ci.org/nette/nette/jobs/5038274

@milo
Copy link
Member

@milo milo commented on 0e23c0a Feb 27, 2013

Choose a reason for hiding this comment

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

Really WTF. I have done more... With this code (milo/tester@634475b) this message (https://travis-ci.org/milo/nette/jobs/5099125).

It corresponds with PHP BUG #35326 (https://bugs.php.net/bug.php?id=35326) maybe. If yes, @mkdir('tmp') (the base temp dir) in bootstrap helps.

Please sign in to comment.