Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37640

Zip unit tests failing under Windows

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: Unit tests
    • Labels:

      Description

      When running the unit tests under Windows, the tests in lib\filestorage\tests\zip_packer_test.php fail at a specific point, claiming permission problems...

      D:\xampp\htdocs\master_integration>phpunit -v --debug lib\filestorage\tests\zip_
      packer_test.php
      PHPUnit 3.7.9 by Sebastian Bergmann.
       
      Configuration read from D:\xampp\htdocs\master_integration\phpunit.xml
       
       
      Starting test 'zip_packer_testcase::test_get_packer'.
      .
      Starting test 'zip_packer_testcase::test_list_files'.
      .
      Starting test 'zip_packer_testcase::test_archive_to_pathname'.
      .
      Starting test 'zip_packer_testcase::test_archive_to_storage'.
      .
      Starting test 'zip_packer_testcase::test_extract_to_pathname'.
      .
      Starting test 'zip_packer_testcase::test_extract_to_pathname_onlyfiles'.
      .
      Starting test 'zip_packer_testcase::test_extract_to_storage'.
      .
      Starting test 'zip_packer_testcase::test_add_files'.
      ES
      Warning: mkdir(): Permission denied in D:\xampp\htdocs\master_integration\lib\se
      tuplib.php on line 1213
       
      Fatal error: Uncaught exception 'invalid_dataroot_permissions' with message 'Inv
      alid permissions detected in $CFG->dataroot directory, administrator has to fix
      permissions. (D:\xampp\Data\master_integration_MySQL_phpunit/temp/ can not be cr
      eated, check permissions.)' in D:\xampp\htdocs\master_integration\lib\setuplib.p
      hp:1215
      Stack trace:
      #0 D:\xampp\htdocs\master_integration\lib\setuplib.php(1288): make_writable_dire
      ctory('D:\xampp\Data\m...', true)
      #1 D:\xampp\htdocs\master_integration\lib\testing\classes\util.php(599): make_te
      mp_directory('')
      #2 D:\xampp\htdocs\master_integration\lib\phpunit\classes\util.php(195): testing
      _util::reset_dataroot()
      #3 D:\xampp\htdocs\master_integration\lib\phpunit\classes\advanced_testcase.php(
      331): phpunit_util::reset_all_data()
      #4 [internal function]: advanced_testcase::tearDownAfterClass()
      #5 D:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php(756): call_user_func(Array)
       
      #6 D:\xampp\php\PEAR\PHPUnit\TextUI\TestRunner.php(346): PHPUnit_Framework_TestS
      uite->run(Object(PHPUnit_Framework_Test in D:\xampp\htdocs\master_integration\li
      b\setuplib.php on line 1215
      

      Even though a permission error is reported, I don't believe that is the case. I'm not sure exactly what's going on, but looking at the directory involved, there's no permission stopping this test in the specified directory.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              salvetore Michael de Raadt added a comment -

              Raj was kind enough to verify this error under Windows.

              Show
              salvetore Michael de Raadt added a comment - Raj was kind enough to verify this error under Windows.
              Hide
              skodak Petr Skoda added a comment -

              Hmm, if you get this type of permission error Moodle zipping can not work. Please double check the permissions for current user in the phpunit dataroot.

              Show
              skodak Petr Skoda added a comment - Hmm, if you get this type of permission error Moodle zipping can not work. Please double check the permissions for current user in the phpunit dataroot.
              Hide
              skodak Petr Skoda added a comment -

              rehmm, maybe some open file handle somewhere

              Show
              skodak Petr Skoda added a comment - rehmm, maybe some open file handle somewhere
              Hide
              skodak Petr Skoda added a comment -

              Could you please try the patched testcase? I hope I found it, but I do not have windows test setup, sorry.

              Show
              skodak Petr Skoda added a comment - Could you please try the patched testcase? I hope I found it, but I do not have windows test setup, sorry.
              Hide
              salvetore Michael de Raadt added a comment -

              Hi, Petr.

              I added those statements, but I am still getting the same result. There is one very minor change: instead of ES before the error message, it now only reports E.

              I'm still confident this is not a permission issue. Removed the phpunit directory for the instance and set it up again. I only ran this set of tests. Before the tests start there is a temp directory. After the tests fail, there is no temp directory.

              Show
              salvetore Michael de Raadt added a comment - Hi, Petr. I added those statements, but I am still getting the same result. There is one very minor change: instead of ES before the error message, it now only reports E. I'm still confident this is not a permission issue. Removed the phpunit directory for the instance and set it up again. I only ran this set of tests. Before the tests start there is a temp directory. After the tests fail, there is no temp directory.
              Hide
              timhunt Tim Hunt added a comment -

              +1 this fixes the unit tests on Windows for me.

              Show
              timhunt Tim Hunt added a comment - +1 this fixes the unit tests on Windows for me.
              Hide
              skodak Petr Skoda added a comment -

              Thanks a lot Tim!

              Show
              skodak Petr Skoda added a comment - Thanks a lot Tim!
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Thanks Petr - nice and easy integrated now.

              Show
              samhemelryk Sam Hemelryk added a comment - Thanks Petr - nice and easy integrated now.
              Hide
              salvetore Michael de Raadt added a comment -

              This now works under Windows. I'm leaving this for Damyon to test under Linux.

              Show
              salvetore Michael de Raadt added a comment - This now works under Windows. I'm leaving this for Damyon to test under Linux.
              Hide
              damyon Damyon Wiese added a comment -

              Tests on master pass under linux. Thanks!

              Show
              damyon Damyon Wiese added a comment - Tests on master pass under linux. Thanks!
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              A brilliant future is awaiting us out there, better with your code. Let's look towards the future together, this is now closed.

              (and won't be revisiting it unless some regression is found)

              Thanks and ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - A brilliant future is awaiting us out there, better with your code. Let's look towards the future together, this is now closed. (and won't be revisiting it unless some regression is found) Thanks and ciao

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/13