1. 18 6月, 2022 1 次提交
    • J
      Pass all paths to `Step::run` at once when using `ShouldRun::krate` · 0da0a219
      Joshua Nelson 提交于
      This was surprisingly complicated. The main changes are:
      1. Invert the order of iteration in `StepDescription::run`.
      
          Previously, it did something like:
          ```python
          for path in paths:
          for (step, should_run) in should_runs:
              if let Some(set) = should_run.pathset_for_path(path):
              step.run(builder, set)
          ```
      
          That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run`
          (since `pathset_for_paths` only had one path available to it).
          Change it to instead look at the intersection of `paths` and `should_run.paths`:
      
          ```python
          for (step, should_run) in should_runs:
          if let Some(set) = should_run.pathset_for_paths(paths):
              step.run(builder, set)
          ```
      
      2. Change `pathset_for_path` to take multiple pathsets.
      
          The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc.
          The changes here are similarly subtle, to use the intersection between the paths rather than all
          paths in `should_run.paths`. I added a test for the behavior to try and make it more clear.
      
          Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*).
          See the documentation added in the next commit for more detail.
      
      3. Change `StepDescription::run` to explicitly handle 0 paths.
      
         Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths.
         Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`).
      
      4. Change `RunDescription` to have a list of pathsets, rather than a single path.
      
      5. Remove paths as they're matched
      
         This allows checking at the end that no invalid paths are left over.
         Note that if two steps matched the same path, this will no longer run both;
         but that's a bug anyway.
      
      6. Handle suite paths separately from regular sets.
      
         Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful.
         The respective test Steps already handle this by introspecting the original paths.
      
         Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.
      0da0a219
  2. 17 6月, 2022 12 次提交
  3. 16 6月, 2022 27 次提交