@ThaDafinser opened this Pull Request on September 2nd 2015 Contributor

Allow running tests on windows
http://forum.piwik.org/read.php?15,126943

Started around with this php console tests:run unit

Did you know? You can run tests faster by disabling xdebug (if you need xdebug, speed up tests by setting xdebug.coverage_enable=0)
Executing command: cd C:\Data\wap\htdocs\GitHub\piwik/tests/PHPUnit && C:\Data\wap\htdocs\GitHub\piwik/vendor/bin/phpunit   --testsuite UnitTests
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

Runtime:    PHP 5.6.7 with Xdebug 2.3.2
Configuration:  C:\Data\wap\htdocs\GitHub\piwik\tests\PHPUnit\phpunit.xml.dist

..FF.FFFFFFF................................................   60 / 2942 (  2%)
............................................................  120 / 2942 (  4%)
............................................................  180 / 2942 (  6%)
..............................................F..F....F.....  240 / 2942 (  8%)
............................................................  300 / 2942 ( 10%)
............................................................  360 / 2942 ( 12%)
............................................................  420 / 2942 ( 14%)
............................................................  480 / 2942 ( 16%)
......................F.......FF...FFFF.....................  540 / 2942 ( 18%)
........FFFFFFFFFFFFFFFFFF..................................  600 / 2942 ( 20%)
............................................................  660 / 2942 ( 22%)
..............FF.....F.FFF.F...FFFF...........SSFFFF.FFFFF.F  720 / 2942 ( 24%)
F...........................................................  780 / 2942 ( 26%)
............................................................  840 / 2942 ( 28%)
............................................................  900 / 2942 ( 30%)
............................................................  960 / 2942 ( 32%)
............................................................ 1020 / 2942 ( 34%)
............................................................ 1080 / 2942 ( 36%)
............................................................ 1140 / 2942 ( 38%)
............................................................ 1200 / 2942 ( 40%)
............................................................ 1260 / 2942 ( 42%)
............................................................ 1320 / 2942 ( 44%)
............................................................ 1380 / 2942 ( 46%)
.F..FF.F.F...FFFFFFFFF.FFF.....F..FFFFFFFFFFFFF............. 1440 / 2942 ( 48%)
..............................................FFFFFFFFFFFFFF 1500 / 2942 ( 50%)
FFFFFF...................................................... 1560 / 2942 ( 53%)
............................................................ 1620 / 2942 ( 55%)
............................................................ 1680 / 2942 ( 57%)
............................................................ 1740 / 2942 ( 59%)
............................................................ 1800 / 2942 ( 61%)
............................................................ 1860 / 2942 ( 63%)
............................................................ 1920 / 2942 ( 65%)
............................................................ 1980 / 2942 ( 67%)
............................................................ 2040 / 2942 ( 69%)
............................................................ 2100 / 2942 ( 71%)
............................................................ 2160 / 2942 ( 73%)
............................................................ 2220 / 2942 ( 75%)
............................................................ 2280 / 2942 ( 77%)
............................................................ 2340 / 2942 ( 79%)
............................................................ 2400 / 2942 ( 81%)
............................................................ 2460 / 2942 ( 83%)
............................................................ 2520 / 2942 ( 85%)
............................................................ 2580 / 2942 ( 87%)
............................................................ 2640 / 2942 ( 89%)
............................................................ 2700 / 2942 ( 91%)
............................................................ 2760 / 2942 ( 93%)
............................................................ 2820 / 2942 ( 95%)
.............E.............................................. 2880 / 2942 ( 97%)
............................................................ 2940 / 2942 ( 99%)
@ThaDafinser commented on September 2nd 2015 Contributor

i executed vendor\bin\php-cs-fixer fix [PATHS...] --fixers=linefeed for the newline problems

folders: core/plugins/tests

@ThaDafinser commented on September 2nd 2015 Contributor

Getting closer...

@ThaDafinser commented on September 2nd 2015 Contributor

The unit test run now all on windows, expect one...but thats hard to fix since its a file lock with a parallel request!

@tsteur i'm done with it...if you think its good you can merge it.


C:\Data\wap\htdocs\GitHub\piwik>php console tests:run unit
Did you know? You can run tests faster by disabling xdebug (if you need xdebug,
speed up tests by setting xdebug.coverage_enable=0)
Executing command: cd C:\Data\wap\htdocs\GitHub\piwik/tests/PHPUnit && C:\Data\w
ap\htdocs\GitHub\piwik/vendor/bin/phpunit   --testsuite UnitTests
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

Runtime:        PHP 5.6.7 with Xdebug 2.3.2
Configuration:  C:\Data\wap\htdocs\GitHub\piwik\tests\PHPUnit\phpunit.xml.dist

............................................................   60 / 2942 (  2%)
............................................................  120 / 2942 (  4%)
............................................................  180 / 2942 (  6%)
............................................................  240 / 2942 (  8%)
............................................................  300 / 2942 ( 10%)
............................................................  360 / 2942 ( 12%)
............................................................  420 / 2942 ( 14%)
............................................................  480 / 2942 ( 16%)
............................................................  540 / 2942 ( 18%)
............................................................  600 / 2942 ( 20%)
............................................................  660 / 2942 ( 22%)
..............................................SS.........S..  720 / 2942 ( 24%)
............................................................  780 / 2942 ( 26%)
............................................................  840 / 2942 ( 28%)
............................................................  900 / 2942 ( 30%)
............................................................  960 / 2942 ( 32%)
............................................................ 1020 / 2942 ( 34%)
............................................................ 1080 / 2942 ( 36%)
............................................................ 1140 / 2942 ( 38%)
............................................................ 1200 / 2942 ( 40%)
............................................................ 1260 / 2942 ( 42%)
............................................................ 1320 / 2942 ( 44%)
............................................................ 1380 / 2942 ( 46%)
............................................................ 1440 / 2942 ( 48%)
............................................................ 1500 / 2942 ( 50%)
............................................................ 1560 / 2942 ( 53%)
............................................................ 1620 / 2942 ( 55%)
............................................................ 1680 / 2942 ( 57%)
............................................................ 1740 / 2942 ( 59%)
............................................................ 1800 / 2942 ( 61%)
............................................................ 1860 / 2942 ( 63%)
............................................................ 1920 / 2942 ( 65%)
............................................................ 1980 / 2942 ( 67%)
............................................................ 2040 / 2942 ( 69%)
............................................................ 2100 / 2942 ( 71%)
............................................................ 2160 / 2942 ( 73%)
............................................................ 2220 / 2942 ( 75%)
............................................................ 2280 / 2942 ( 77%)
............................................................ 2340 / 2942 ( 79%)
............................................................ 2400 / 2942 ( 81%)
............................................................ 2460 / 2942 ( 83%)
............................................................ 2520 / 2942 ( 85%)
............................................................ 2580 / 2942 ( 87%)
............................................................ 2640 / 2942 ( 89%)
............................................................ 2700 / 2942 ( 91%)
............................................................ 2760 / 2942 ( 93%)
............................................................ 2820 / 2942 ( 95%)
.............E.............................................. 2880 / 2942 ( 97%)
............................................................ 2940 / 2942 ( 99%)
..

Time: 1.55 minutes, Memory: 49.50Mb

There was 1 error:

1) Piwik\Plugins\UserCountry\tests\Unit\UserCountryTest::testGeoIpUpdaterRedunda
ntChecks
rename(C:\Data\wap\htdocs\GitHub\piwik/tests/lib/geoip-files/GeoIPISP.dat,C:\Dat
a\wap\htdocs\GitHub\piwik/tests/lib/geoip-files/GeoIPISP.dat.broken): Der Prozes
s kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet
 wird. (code: 32)

C:\Data\wap\htdocs\GitHub\piwik\plugins\UserCountry\GeoIPAutoUpdater.php:563
C:\Data\wap\htdocs\GitHub\piwik\plugins\UserCountry\tests\Unit\UserCountryTest.p
hp:181
C:\Data\wap\htdocs\GitHub\piwik\plugins\UserCountry\tests\Unit\UserCountryTest.p
hp:92

--

There were 3 skipped tests:

1) Piwik\Tests\Unit\Metrics\FormatterTest::test_getPrettyTimeFromSeconds_Returns
CorrectResult with data set <a href='/6'>#6</a> (31536000, array('365 days 0 hours', '8760:00:00'
))
Will not pass on 32-bit machine.

C:\Data\wap\htdocs\GitHub\piwik\tests\PHPUnit\Unit\Metrics\FormatterTest.php:116

2) Piwik\Tests\Unit\Metrics\FormatterTest::test_getPrettyTimeFromSeconds_Returns
CorrectResult with data set <a href='/7'>#7</a> (32421600.0, array('1 years 10 days', '9006:00:00
'))
Will not pass on 32-bit machine.

C:\Data\wap\htdocs\GitHub\piwik\tests\PHPUnit\Unit\Metrics\FormatterTest.php:116

3) Piwik\Tests\Unit\Metrics\FormatterTest::test_getPrettyTimeFromSeconds_Returns
CorrectResult with data set <a href='/17'>#17</a> (-31536000, array('-365 days 0 hours', '-8760:00
:00'))
Will not pass on 32-bit machine.

C:\Data\wap\htdocs\GitHub\piwik\tests\PHPUnit\Unit\Metrics\FormatterTest.php:116

FAILURES!
Tests: 2942, Assertions: 5865, Errors: 1, Skipped: 3.

C:\Data\wap\htdocs\GitHub\piwik>
@tsteur commented on September 2nd 2015 Owner

I'm getting the same error under Linux/Ubuntu. Never looked into it.

@ThaDafinser commented on September 2nd 2015 Contributor

After this is merged, i will look into https://github.com/piwik/piwik/pull/8648 again

@mattab commented on September 3rd 2015 Owner

Left a comment, otherwise looks good to me :+1:

@ThaDafinser commented on September 3rd 2015 Contributor

@mattab ty for the review. I changed that line

@mattab commented on September 8th 2015 Owner

Thanks @ThaDafinser - btw are tests passing on your Windows machine now?

@ThaDafinser commented on September 9th 2015 Contributor

@mattab with this PR yes. Expect this error

There was 1 error:

1) Piwik\Plugins\UserCountry\tests\Unit\UserCountryTest::testGeoIpUpdaterRedunda
ntChecks
rename(C:\Data\wap\htdocs\GitHub\piwik/tests/lib/geoip-files/GeoIPISP.dat,C:\Dat
a\wap\htdocs\GitHub\piwik/tests/lib/geoip-files/GeoIPISP.dat.broken): Der Prozes
s kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet
 wird. (code: 32)

C:\Data\wap\htdocs\GitHub\piwik\plugins\UserCountry\GeoIPAutoUpdater.php:563
C:\Data\wap\htdocs\GitHub\piwik\plugins\UserCountry\tests\Unit\UserCountryTest.p
hp:181
C:\Data\wap\htdocs\GitHub\piwik\plugins\UserCountry\tests\Unit\UserCountryTest.p
hp:92
@mattab commented on September 11th 2015 Owner

from @diosmosis

just a note: since the addition of https://github.com/piwik/piwik/blob/master/.gitattributes it is now required to add an entry to the file when adding a new type of binary file to the repo (eg, *.bz2 binary)

@tsteur commented on September 11th 2015 Owner

@ThaDafinser I'm having problems when switching between branches that do not contain this .gitattributes. I often see uncommited changes but cannot do a git checkout etc. git checkout simply does nothing. Then I'm not able to switch to another branch.

Our developer docs generator had similar problems and workaround for now is to stop switching between branches: https://github.com/piwik/developer-documentation/issues/102

Do you know what I mean? Have you ever had such problems? Do you maybe know how to fix it?

@ThaDafinser commented on September 11th 2015 Contributor

@tsteur i had that problems some time ago - the changes are just the diff between \n and \r\n

_Solution should be_ https://help.github.com/articles/dealing-with-line-endings/#refreshing-a-repository-after-changing-line-endings

@tsteur commented on September 22nd 2015 Owner

It kinda works but always have to do it when switching to master because of a few files eg (.gz files). Is there a more permanent solution do this? It always takes me a couple of minutes to switch to eg master

@ThaDafinser commented on September 22nd 2015 Contributor

@tsteur then we have to add the .gz files too ignore that

from @diosmosis

just a note: since the addition of https://github.com/piwik/piwik/blob/master/.gitattributes it is now required to add an entry to the file when adding a new type of binary file to the repo (eg, *.bz2 binary)

@ThaDafinser commented on September 22nd 2015 Contributor

A side note: This addition will ensure in the future, that there are no compability issues between the OS which is used by developers. It's also a part of psr-2 (or 1?) so it will help a lot.

@tsteur commented on September 23rd 2015 Owner

I think .gz is already listed here, I'll have a look next time I face that issue again. Yes I definitely see a value in it just wondering if there's a more efficient way to switch between branches :)

@tsteur commented on September 23rd 2015 Owner

It's actually those files that make me trouble:

    modified:   tests/javascript/frameworks/ext/ext-all-2.3.0.js
    modified:   tests/javascript/frameworks/ext/ext-base-2.3.0.js
    modified:   tests/javascript/frameworks/jquery/jquery-1.0.4.js
    modified:   tests/javascript/frameworks/jquery/jquery-1.3.2.js
@diosmosis commented on September 23rd 2015 Member

@tsteur This happens when switching to a branch older than the .gitattributes file. You can deal w/ this by:

git checkout troublesome_branch
git commit -a -m "Redundant normalization"
git rebase master # rebasing will end up removing the commit above since it is redundant w/ master

After this, you won't see the problem for the branch.

@tsteur commented on September 24th 2015 Owner

Thx a lot I'll try it next time

@tsteur commented on September 24th 2015 Owner

I think it worked, thx! Only the rebasing hurt a lot this time hehe (there were many changes in many places :) )

@sgiehl commented on September 25th 2015 Member

Guess that .gitattributes are also causing some test failures for plugins... See https://travis-ci.org/piwik/plugin-TasksTimetable/builds/82189993 or https://travis-ci.org/PiwikPRO/plugin-InterSites/jobs/82195390

@ThaDafinser commented on September 28th 2015 Contributor

Another way would be to define only some filetypes:

.php eol=lf
.xml eol=lf

http://permalink.gmane.org/gmane.comp.version-control.git/266905

This will correctly normalize text files in the repo. However, the
second part (LF forcing on checkout) cannot be achieved easily today
because adding eol=lf will unfortunately process binary files too.
The only solution today is to mark certain types for conversion (e.g.,
*.txt eol=lf) or, inversely, mark certain types as binary (e.g.,
*.png binary).

@mattab commented on October 1st 2015 Owner

@sgiehl @ThaDafinser Created issue: https://github.com/piwik/piwik/issues/8879 - any idea or even PR welcome

This Pull Request was closed on September 8th 2015
Powered by GitHub Issue Mirror