You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 10 години
преди 11 години
преди 11 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. ::
  2. :: ownCloud
  3. ::
  4. :: @author Thomas Müller
  5. :: @author Tobias Ramforth (translated into Windows batch file)
  6. ::
  7. :: @copyright 2012, 2013 Thomas Müller thomas.mueller@tmit.eu
  8. ::
  9. set DATADIR=data-autotest
  10. set BASEDIR=%~dp0
  11. :: create autoconfig for sqlite, mysql, postgresql and mssql
  12. echo ^<?php > .\tests\autoconfig-sqlite.php
  13. echo $AUTOCONFIG ^= array ^( >> .\tests\autoconfig-sqlite.php
  14. echo 'installed' ^=^> false^, >> .\tests\autoconfig-sqlite.php
  15. echo 'dbtype' ^=^> 'sqlite'^, >> .\tests\autoconfig-sqlite.php
  16. echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-sqlite.php
  17. echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-sqlite.php
  18. echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-sqlite.php
  19. echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-sqlite.php
  20. echo ^)^; >> .\tests\autoconfig-sqlite.php
  21. echo ^<?php > .\tests\autoconfig-mysql.php
  22. echo $AUTOCONFIG ^= array ^( >> .\tests\autoconfig-mysql.php
  23. echo 'installed' ^=^> false^, >> .\tests\autoconfig-mysql.php
  24. echo 'dbtype' ^=^> 'mysql'^, >> .\tests\autoconfig-mysql.php
  25. echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-mysql.php
  26. echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-mysql.php
  27. echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-mysql.php
  28. echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-mysql.php
  29. echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mysql.php
  30. echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mysql.php
  31. echo 'dbhost' ^=^> 'localhost'^, >> .\tests\autoconfig-mysql.php
  32. echo 'dbpass' ^=^> 'owncloud'^, >> .\tests\autoconfig-mysql.php
  33. echo ^)^; >> .\tests\autoconfig-mysql.php
  34. echo ^<?php > .\tests\autoconfig-pgsql.php
  35. echo $AUTOCONFIG ^= array ^( >> .\tests\autoconfig-pgsql.php
  36. echo 'installed' ^=^> false^, >> .\tests\autoconfig-pgsql.php
  37. echo 'dbtype' ^=^> 'pgsql'^, >> .\tests\autoconfig-pgsql.php
  38. echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-pgsql.php
  39. echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-pgsql.php
  40. echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-pgsql.php
  41. echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-pgsql.php
  42. echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-pgsql.php
  43. echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-pgsql.php
  44. echo 'dbhost' ^=^> 'localhost'^, >> .\tests\autoconfig-pgsql.php
  45. echo 'dbpass' ^=^> 'owncloud'^, >> .\tests\autoconfig-pgsql.php
  46. echo ^)^; >> .\tests\autoconfig-pgsql.php
  47. echo ^<?php > .\tests\autoconfig-mssql.php
  48. echo $AUTOCONFIG ^= array ^( >> .\tests\autoconfig-mssql.php
  49. echo 'installed' ^=^> false^, >> .\tests\autoconfig-mssql.php
  50. echo 'dbtype' ^=^> 'mssql'^, >> .\tests\autoconfig-mssql.php
  51. echo 'dbtableprefix' ^=^> 'oc_'^, >> .\tests\autoconfig-mssql.php
  52. echo 'adminlogin' ^=^> 'admin'^, >> .\tests\autoconfig-mssql.php
  53. echo 'adminpass' ^=^> 'admin'^, >> .\tests\autoconfig-mssql.php
  54. echo 'directory' ^=^> '%BASEDIR%%DATADIR%'^, >> .\tests\autoconfig-mssql.php
  55. echo 'dbuser' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mssql.php
  56. echo 'dbname' ^=^> 'oc_autotest'^, >> .\tests\autoconfig-mssql.php
  57. echo 'dbhost' ^=^> 'localhost\sqlexpress'^, >> .\tests\autoconfig-mssql.php
  58. echo 'dbpass' ^=^> 'owncloud'^, >> .\tests\autoconfig-mssql.php
  59. echo ^)^; >> .\tests\autoconfig-mssql.php
  60. echo localhost:5432:*:oc_autotest:owncloud > %APPDATA%\postgresql\pgpass.conf
  61. ::
  62. :: start test execution
  63. ::
  64. if [%1] == [] (
  65. echo "Running on all database backends"
  66. call:execute_tests "sqlite"
  67. call:execute_tests "mysql"
  68. call:execute_tests "mssql"
  69. ::call:execute_tests "ora"
  70. call:execute_tests "pgsql"
  71. ) else (
  72. call:execute_tests "%1"
  73. )
  74. goto:eof
  75. :execute_tests
  76. echo "Setup environment for %~1 testing ..."
  77. :: back to root folder
  78. cd %BASEDIR%
  79. :: revert changes to tests\data
  80. git checkout tests\data\*
  81. :: reset data directory
  82. rmdir /s /q %DATADIR%
  83. md %DATADIR%
  84. :: remove the old config file
  85. :: del /q /f config\config.php
  86. copy /y tests\preseed-config.php config\config.php
  87. :: drop database
  88. if "%~1" == "mysql" mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
  89. if "%~1" == "pgsql" dropdb -h localhost -p 5432 -U oc_autotest -w oc_autotest
  90. :: we assume a sqlexpress installation
  91. if "%~1" == "mssql" sqlcmd -S localhost\sqlexpress -U oc_autotest -P owncloud -Q "IF EXISTS (SELECT name FROM sys.databases WHERE name=N'oc_autotest') DROP DATABASE [oc_autotest]"
  92. :: copy autoconfig
  93. copy /y %BASEDIR%\tests\autoconfig-%~1.php %BASEDIR%\config\autoconfig.php
  94. :: trigger installation
  95. php -f index.php
  96. ::test execution
  97. echo "Testing with %~1 ..."
  98. cd tests
  99. rmdir /s /q coverage-html-%~1
  100. md coverage-html-%~1
  101. php -f enable_all.php
  102. 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
  103. echo "Done with testing %~1 ..."
  104. cd %BASEDIR%
  105. goto:eof
  106. ::
  107. :: NOTES on mysql:
  108. :: - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
  109. :: - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
  110. ::
  111. :: NOTES on pgsql:
  112. :: - su - postgres
  113. :: - createuser -P (enter username and password and enable superuser)
  114. :: - to enable dropdb I decided to add following line to pg_hba.conf (this is not the safest way but I don't care for the testing machine):
  115. :: local all all trust
  116. ::
  117. :: NOTES on mssql:
  118. :: we assume the usage of a local installed sqlexpress
  119. :: create a user 'oc_autotest' with password 'owncloud' and assign the server role 'dbcreator'
  120. :: make sure the sqlserver is configured to allow sql authentication
  121. ::