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

Add ability to prevent some files from being covered during unit testing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.7.1, 3.8
    • 3.7.1
    • Unit tests
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MOODLE_37_STABLE
    • MDL-65656-master-2
    • Hide
      1. Ensure you have a recent version of PHP (minimum 7.2.18, 7.3.5)
      2. Init phpunit
      3. Run phpunit with coverage:

        phpdbg -qrr ./vendor/bin/phpunit --coverage-html coverage  analytics/tests/prediction_test.php
        

        1. Confirm the memory used was not insanely large (like 76GB)
      Show
      Ensure you have a recent version of PHP (minimum 7.2.18, 7.3.5) Init phpunit Run phpunit with coverage: phpdbg -qrr ./vendor/bin/phpunit --coverage-html coverage analytics/tests/prediction_test.php Confirm the memory used was not insanely large (like 76GB)

    Description

      There are a couple of tests relating to analytics which have extremely high memory consumption when coverage generation is enabled (over 70GB).

      This happens because phpdbg and xdebug keep track of each line of code, each time that it is executed as part of their opcache logging functionality.

      Although we don't actually generate coverage for these files right now, we have no way to prevent the opcache log from running against these files due to the nature of php-code-coverage.

      It is (now) possible to do this via standard phpunit annotations - specifically the `@coversNothing` annotation. I had tried this before, but it was not working due to a bug in phpunit which I have now fixed (and has been released upstream).

      Attachments

        Activity

          People

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Simey Lameze Simey Lameze
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Andrew Lyons Andrew Lyons
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8/Jul/19

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 31 minutes
                1h 31m