Skip to content
  • Rodrigo Mesquita's avatar
    d6e38041
    HPC artifacts are written and read from pkg-db · d6e38041
    Rodrigo Mesquita authored
    This commit re-designs the mechanism by which we make the .mix files of
    libraries available to produce the Haskell Program Coverage report after
    running testsuites.
    
    The idea, for the Cabal library, is:
    
    * Cabal builds libraries with -fhpc, and store the hpc artifacts in
      build </> `extraCompilationArtifacts`
    * At Cabal install time, `extraCompilationArtifacts` is copied into the
      package database
    * At Cabal configure time, we both
        - receive as --coverage-for flags unit-ids of library components
          from the same package (ultimately, when #9493 is resolved, we will
          receive unit ids of libraries in other packages in the same
          project too),
        - and, when configuring a whole package instead of just a testsuite
          component, we determine the unit-ids of libraries in the package
      these unit-ids are written into `configCoverageFor` in `ConfigFlags`
    * At Cabal test time, for each library to cover (stored in
      `configCoverageFor`), we look in the package database for the hpc
      dirs, which we eventually pass along to the `hpc markup` call as
      `--hpcdir` flags
    
    As for cabal-install:
    
    * After a plan has been elaborated, we select the packages which can be
      covered and pass them to Cabal's ./Setup configure as
      --coverage-for=<unit-id> flags.
        - Notably, valid libraries are non-indefinite and
          non-instantiations, since HPC does not support backpack.
        - Furthermore, we only include libraries in the same package as the
          component being configured, despite possibly there being
          more library components in other packages of the same project.
          When #9493 is resolved, we could lift this restriction and pass
          all libraries local to the package as --coverage-for. See
          `determineCoverageFor` and `shouldCoverPkg` in Distribution.Client.ProjectPlanning.
    
    Detail:
        We no longer pass the path to the testsuite's mix dirs to `hpc
        markup` because we only ever include modules in libraries, which
        means they were previously unused.
    
    Fixes #6440 (internal libs coverage), #6397 (backpack breaks coverage),
    doesn't yet fix #8609 (multi-package coverage report) which is tracked
    in #9493, and fixes in a new way the previously fixed #4798, #5213.
    d6e38041
    HPC artifacts are written and read from pkg-db
    Rodrigo Mesquita authored
    This commit re-designs the mechanism by which we make the .mix files of
    libraries available to produce the Haskell Program Coverage report after
    running testsuites.
    
    The idea, for the Cabal library, is:
    
    * Cabal builds libraries with -fhpc, and store the hpc artifacts in
      build </> `extraCompilationArtifacts`
    * At Cabal install time, `extraCompilationArtifacts` is copied into the
      package database
    * At Cabal configure time, we both
        - receive as --coverage-for flags unit-ids of library components
          from the same package (ultimately, when #9493 is resolved, we will
          receive unit ids of libraries in other packages in the same
          project too),
        - and, when configuring a whole package instead of just a testsuite
          component, we determine the unit-ids of libraries in the package
      these unit-ids are written into `configCoverageFor` in `ConfigFlags`
    * At Cabal test time, for each library to cover (stored in
      `configCoverageFor`), we look in the package database for the hpc
      dirs, which we eventually pass along to the `hpc markup` call as
      `--hpcdir` flags
    
    As for cabal-install:
    
    * After a plan has been elaborated, we select the packages which can be
      covered and pass them to Cabal's ./Setup configure as
      --coverage-for=<unit-id> flags.
        - Notably, valid libraries are non-indefinite and
          non-instantiations, since HPC does not support backpack.
        - Furthermore, we only include libraries in the same package as the
          component being configured, despite possibly there being
          more library components in other packages of the same project.
          When #9493 is resolved, we could lift this restriction and pass
          all libraries local to the package as --coverage-for. See
          `determineCoverageFor` and `shouldCoverPkg` in Distribution.Client.ProjectPlanning.
    
    Detail:
        We no longer pass the path to the testsuite's mix dirs to `hpc
        markup` because we only ever include modules in libraries, which
        means they were previously unused.
    
    Fixes #6440 (internal libs coverage), #6397 (backpack breaks coverage),
    doesn't yet fix #8609 (multi-package coverage report) which is tracked
    in #9493, and fixes in a new way the previously fixed #4798, #5213.
Loading