Skip to content

Set MPI providers for test config#16003

Merged
scheibelp merged 18 commits intospack:developfrom
scheibelp:bugfix/set-mpi-providers-for-tests
May 1, 2020
Merged

Set MPI providers for test config#16003
scheibelp merged 18 commits intospack:developfrom
scheibelp:bugfix/set-mpi-providers-for-tests

Conversation

@scheibelp
Copy link
Copy Markdown
Member

For tests that use the real Spack package repository, the config needs to avoid using MPI providers that are not intended to be installed by Spack. Without this, it is possible that Spack tests which concretize the MPI virtual will end up trying to use an implementation that it shouldn't (e.g. one that is always provided externally).

See: #15666 (and specifically the tests for it at https://travis-ci.org/github/spack/spack/jobs/672203234)

…s to avoid using providers that are not intended to be installed by Spack
@scheibelp

This comment has been minimized.

@adamjstewart adamjstewart added configuration mpi tests General test capability(ies) labels Apr 11, 2020
@scheibelp
Copy link
Copy Markdown
Member Author

scheibelp commented Apr 17, 2020

Extra fixes based on follow-up errors:

  • mutable_config was not initializing the scope roots to the right directories
  • mutable_config was not clearing config caches (this has since been removed - the use_configuration fixture replaces the configuration entirely)
  • The current_host fixture in the concretize.py tests was not being executed in the context of mutable_config, and was polluting the config cache for other tests
  • One test in concretize_preference was depending on cross test config pollution to succeed, I have explicitly updated the initial spec it constructs to arrive at the appropriate result
  • One test in concretize.py was clearing a nonexistent cache (PackagePrefs._packages_config_cache) - which created a red herring

Additional notes

  • Any test using config.override should use mutable_config (since this can change the contents of the in-memory config cache)
  • Tests will not be able to use config.clear_caches() with the config fixture, since that removes the _builtin scope with default settings. If the config fixture were refactored it would be possible to do this but I don't think it makes sense (semantically it is a bit contradictory to have an implied non-mutable set-up fixture that then requires teardown on the part of the user). (the use_configuration fixture should generally resolve these issues, so long as each test that uses the config fixture doesn't actually modify it - in that case it will change the config for all other tests using that fixture)

Based on that, my additional suggestion (which may be appropriate for this PR) is to raise an error if a user tries to call config.override when the config fixture is in use (or perhaps even better, whenever the mutable_config fixture is not in use).

@scheibelp scheibelp requested a review from alalazo April 21, 2020 02:47
@tgamblin tgamblin self-requested a review April 21, 2020 21:12
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I just have a few questions/comments.

@scheibelp scheibelp merged commit 31d12d3 into spack:develop May 1, 2020
@alalazo
Copy link
Copy Markdown
Member

alalazo commented May 1, 2020

@scheibelp Don't know what went wrong, but apparently this PR is not passing unit tests on develop. See https://travis-ci.org/github/spack/spack/jobs/682049262

@scheibelp
Copy link
Copy Markdown
Member Author

OK - I don't have time to fix this so I'll have to revert it and get back to fixing whatever other test pollution is occurring that is resulting in this next week.

scheibelp added a commit to scheibelp/spack that referenced this pull request May 1, 2020
scheibelp added a commit that referenced this pull request May 1, 2020
scheibelp added a commit to scheibelp/spack that referenced this pull request May 2, 2020
scheibelp added a commit that referenced this pull request May 7, 2020
This fixes some errors with setting up test configuration. These
errors do not cause current Spack tests to fail but do create
red herring issues elsewhere (see #15666). Fixing these errors
leads to more errors in tests that depended on the original
misconfigured state, so those are also addressed here.

This is an update to #16003 which accounts for some unit tests with
conflicting config/mutable_config fixtures. These conflicts were
not exposed until the mutable_config fixture was fixed. Details are
included below. The change which builds on #16003 is prefixed with
"(new)".

* For tests that use the real Spack package repository, the config
  needs to avoid using MPI providers that are not intended to be
  installed by Spack. Without this, it is possible that Spack tests
  which concretize the MPI virtual will end up trying to use an
  implementation that it shouldn't (e.g. one that is always
  provided externally). See #15666 for an example.
* The mutable_config test fixture was not initializing the scope
  roots to the right directories (so the resulting config was empty).
* The current_host fixture in the concretize.py tests was using the
  config fixture rather than mutable_config, and was polluting the
  config cache for other tests.
* One test in concretize.py was clearing a nonexistent cache
  (PackagePrefs._packages_config_cache). This reference has been
  removed.
* The test 'test_preferred_compilers' was was depending on cross
  test config pollution to succeed. The initial spec before
  concretization has been updated to updated to be explicit about
  the desired result.
* (new) For tests that use install_mockery and mutable_config,
  replace install_mockery with a separate install_mockery_mutable_config
  fixture that is exactly the same as install_mockery but uses the
  mutable_config fixture to avoid conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants