From 7e47a363ff7255af36cb0c00461889985d84bb3f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 2 Dec 2014 12:19:17 +0100 Subject: [PATCH 1/4] Better manage the output when running autotest.cmd --- autotest.cmd | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/autotest.cmd b/autotest.cmd index 5f1b1ae3a1..1b33596ba3 100644 --- a/autotest.cmd +++ b/autotest.cmd @@ -7,8 +7,10 @@ :: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu :: -set DATADIR=data-autotest +@echo off + set BASEDIR=%~dp0 +set DATADIR=data-autotest :: create autoconfig for sqlite, mysql, postgresql and mssql echo ^ .\tests\autoconfig-sqlite.php @@ -82,7 +84,9 @@ if [%1] == [] ( goto:eof :execute_tests - echo "Setup environment for %~1 testing ..." + @echo on + + @echo "Setup environment for %~1 testing ..." :: back to root folder cd %BASEDIR% @@ -109,14 +113,17 @@ goto:eof copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php :: trigger installation - php -f index.php + @echo INDEX + call php -f index.php + @echo END INDEX ::test execution - echo "Testing with %~1 ..." + @echo "Testing with %~1 ..." cd tests rmdir /s /q coverage-html-%~1 md coverage-html-%~1 php -f enable_all.php + :: no external files on windows for now cd .. php occ app:disable files_external @@ -124,7 +131,7 @@ goto:eof call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 - echo "Done with testing %~1 ..." + @echo "Done with testing %~1 ..." cd %BASEDIR% goto:eof From a73023fe05664b4c5a45a18d2ecbc886a2a33704 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 2 Dec 2014 12:20:07 +0100 Subject: [PATCH 2/4] Allow passing a test file just like in autotest.sh --- autotest.cmd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/autotest.cmd b/autotest.cmd index 1b33596ba3..a6119f5afd 100644 --- a/autotest.cmd +++ b/autotest.cmd @@ -72,13 +72,13 @@ echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf :: if [%1] == [] ( echo "Running on all database backends" - call:execute_tests "sqlite" - call:execute_tests "mysql" - call:execute_tests "mssql" - ::call:execute_tests "ora" - call:execute_tests "pgsql" + call:execute_tests "sqlite" "%2" + call:execute_tests "mysql" "%2" + call:execute_tests "mssql" "%2" + ::call:execute_tests "ora" "%2" + call:execute_tests "pgsql" "%2" ) else ( - call:execute_tests "%1" + call:execute_tests "%1" "%2" ) goto:eof @@ -129,7 +129,7 @@ goto:eof php occ app:disable files_external cd tests - call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 + call phpunit --bootstrap bootstrap.php --configuration phpunit-autotest.xml --log-junit autotest-results-%~1.xml --coverage-clover autotest-clover-%~1.xml --coverage-html coverage-html-%~1 %~2 @echo "Done with testing %~1 ..." cd %BASEDIR% From a0fea16d56682976b64a1c96e583542e12e1763e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 2 Dec 2014 12:21:37 +0100 Subject: [PATCH 3/4] Allow overwriting DATADIR completly so ramdisk can be used --- autotest.cmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autotest.cmd b/autotest.cmd index a6119f5afd..0bff45ef37 100644 --- a/autotest.cmd +++ b/autotest.cmd @@ -10,7 +10,7 @@ @echo off set BASEDIR=%~dp0 -set DATADIR=data-autotest +set DATADIR=%BASEDIR%data-autotest :: create autoconfig for sqlite, mysql, postgresql and mssql echo ^ .\tests\autoconfig-sqlite.php @@ -20,7 +20,7 @@ echo 'dbtype' ^=^> 'sqlite'^, >> .\tests\autoconfig-sqlite.ph echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-sqlite.php echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-sqlite.php echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-sqlite.php -echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-sqlite.php +echo 'directory' ^=^> '%DATADIR%'^, >> .\tests\autoconfig-sqlite.php echo ^)^; >> .\tests\autoconfig-sqlite.php echo ^ .\tests\autoconfig-mysql.php @@ -30,7 +30,7 @@ echo 'dbtype' ^=^> 'mysql'^, >> .\tests\autoconfig-mysql.php echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-mysql.php echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-mysql.php echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-mysql.php -echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-mysql.php +echo 'directory' ^=^> '%DATADIR%'^, >> .\tests\autoconfig-mysql.php echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mysql.php echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mysql.php echo 'dbhost' ^=^> 'localhost'^, >> .\tests\autoconfig-mysql.php @@ -44,7 +44,7 @@ echo 'dbtype' ^=^> 'pgsql'^, >> .\tests\autoconfig-pgsql.php echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-pgsql.php echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-pgsql.php echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-pgsql.php -echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-pgsql.php +echo 'directory' ^=^> '%DATADIR%'^, >> .\tests\autoconfig-pgsql.php echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-pgsql.php echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-pgsql.php echo 'dbhost' ^=^> 'localhost'^, >> .\tests\autoconfig-pgsql.php @@ -58,7 +58,7 @@ echo 'dbtype' ^=^> 'mssql'^, >> .\tests\autoconfig-mssql.php echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-mssql.php echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-mssql.php echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-mssql.php -echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-mssql.php +echo 'directory' ^=^> '%DATADIR%'^, >> .\tests\autoconfig-mssql.php echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mssql.php echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mssql.php echo 'dbhost' ^=^> 'localhost\sqlexpress'^, >> .\tests\autoconfig-mssql.php From 9da4a6323dbfc7f67be56a8c0f30a9a39645553d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 2 Dec 2014 12:41:33 +0100 Subject: [PATCH 4/4] Restore the development config after running the tests --- autotest.cmd | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/autotest.cmd b/autotest.cmd index 0bff45ef37..2129e2d30d 100644 --- a/autotest.cmd +++ b/autotest.cmd @@ -67,11 +67,18 @@ echo ^)^; >> .\tests\autoconfig-mssql.php echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf +@echo on + +:: Back up existing (dev) config if one exists +if exist config\config.php ( + copy /y config\config.php config\config-autotest-backup.php +) + :: :: start test execution :: if [%1] == [] ( - echo "Running on all database backends" + @echo "Running on all database backends" call:execute_tests "sqlite" "%2" call:execute_tests "mysql" "%2" call:execute_tests "mssql" "%2" @@ -81,11 +88,18 @@ if [%1] == [] ( call:execute_tests "%1" "%2" ) +goto:restore_config + +goto:eof + +:restore_config + :: Restore existing config + if exist config\config-autotest-backup.php ( + copy /y config\config-autotest-backup.php config\config.php + ) goto:eof :execute_tests - @echo on - @echo "Setup environment for %~1 testing ..." :: back to root folder cd %BASEDIR%