Commit graph

13 commits

Author SHA1 Message Date
Massimiliano Culpo
05203ec3fb
Add unit test on MacOS using Github Actions (#14220)
- Remove macos tests from travis
- Add macos tests in github actions.
2020-05-09 13:35:14 -07:00
Adam J. Stewart
11f2b61261 Use spack commands --format=bash to generate shell completion (#14393)
This PR adds a `--format=bash` option to `spack commands` to
auto-generate the Bash programmable tab completion script. It can be
extended to work for other shells.

Progress:

- [x] Fix bug in superclass initialization in `ArgparseWriter`
- [x] Refactor `ArgparseWriter` (see below)
- [x] Ensure that output of old `--format` options remains the same
- [x] Add `ArgparseCompletionWriter` and `BashCompletionWriter`
- [x] Add `--aliases` option to add command aliases
- [x] Standardize positional argument names
- [x] Tests for `spack commands --format=bash` coverage
- [x] Tests to make sure `spack-completion.bash` stays up-to-date
- [x] Tests for `spack-completion.bash` coverage
- [x] Speed up `spack-completion.bash` by caching subroutine calls

This PR also necessitates a significant refactoring of
`ArgparseWriter`. Previously, `ArgparseWriter` was mostly a single
`_write` method which handled everything from extracting the information
we care about from the parser to formatting the output. Now, `_write`
only handles recursion, while the information extraction is split into a
separate `parse` method, and the formatting is handled by `format`. This
allows subclasses to completely redefine how the format will appear
without overriding all of `_write`.

Co-Authored-by: Todd Gamblin <tgamblin@llnl.gov>
2020-01-22 21:31:12 -08:00
Adam J. Stewart
5b979aee81
Ignore coverage drop due to lack of macOS tests (#14333)
* Ignore coverage drop due to lack of macOS tests

* Fix codecov tree structure
2019-12-31 15:13:12 -06:00
Todd Gamblin
5ed68d31a2
coverage: restore status updates on PRs (#12032)
Codecov is not updating PRs with status anymore. Fix .codecov.yaml to
make this happen.
2019-07-15 22:45:00 -07:00
Todd Gamblin
47e9f7aac9 tests: add tests for setup-env.sh
- tests use a shell-script harness and test all Spack commands that
  require special shell support.

- tests work in bash, zsh, and dash

- run setup-env.sh tests on macos and linux builds.
  - we run them on macos and linux
2019-07-05 12:54:17 -07:00
Todd Gamblin
c45afb7578
coverage: remove sub-reports; only show project/patch on PRs (#11926)
- There's too much information on our PRs, and the Travis test results
  (which are arguably more important than coverage) get buried in
  coverage information

- Remove coverage sub-categories, as you can browse codecov's file view
  to see roughly the same thing

- show only project/patch on GitHub PRs.
2019-07-03 17:11:07 -07:00
Todd Gamblin
19b7b15929 coverage: use kcov to get coverage for our cc script 2018-12-29 23:47:29 -08:00
Massimiliano Culpo
b1d129e681 Modulefiles generated with a template engine (#3183)
* Module files now are generated using a template engine refers #2902 #3173

jinja2 has been hooked into Spack.

The python module `modules.py` has been splitted into several modules
under the python package `spack/modules`. Unit tests stressing module
file generation have been refactored accordingly.

The module file generator for Lmod has been extended to multi-providers
and deeper hierarchies.

* Improved the support for templates in module files.

Added an entry in `config.yaml` (`template_dirs`) to list all the
directories where Spack could find templates for `jinja2`.

Module file generators have a simple override mechanism to override
template selection ('modules.yaml' beats 'package.py' beats 'default').

* Added jinja2 and MarkupSafe to vendored packages.

* Spec.concretize() sets mutual spec-package references

The correct place to set the mutual references between spec and package
objects at the end of concretization. After a call to concretize we
should now be ensured that spec is the same object as spec.package.spec.

Code in `build_environment.py` that was performing the same operation
has been turned into an assertion to be defensive on the new behavior.

* Improved code and data layout for modules and related tests.

Common fixtures related to module file generation have been extracted
in `conftest.py`. All the mock configurations for module files have been
extracted from python code and have been put into their own yaml file.

Added a `context_property` decorator for the template engine, to make
it easy to define dictionaries out of properties.

The default for `verbose` in `modules.yaml` is now False instead of True.

* Extendable module file contexts + short description from docstring

The contexts that are used in conjunction with `jinja2` templates to
generate module files can now be extended from package.py and
modules.yaml.

Module files generators now infer the short description from package.py
docstring (and as you may expect it's the first paragraph)

* 'module refresh' regenerates all modules by default

`module refresh` without `--module-type` specified tries to
regenerate all known module types. The same holds true for `module rm`

Configure options used at build time are extracted and written into the
module files where possible.

* Fixed python3 compatibility, tests for Lmod and Tcl.

Added test for exceptional paths of execution when generating Lmod
module files.

Fixed a few compatibility issues with python3.

Fixed a bug in Tcl with naming_scheme and autoload + unit tests

* Updated module file tutorial docs. Fixed a few typos in docstrings.

The reference section for module files has been reorganized. The idea is
to have only three topics at the highest level:

  - shell support + spack load/unload use/unuse
  - module file generation (a.k.a. APIs + modules.yaml)
  - module file maintenance (spack module refresh/rm)

Module file generation will cover the entries in modules.yaml

Also:

  - Licenses have been updated to include NOTICE and extended to 2017
  - docstrings have been reformatted according to Google style

* Removed redundant arguments to RPackage and WafPackage.

All the callbacks in `RPackage` and `WafPackage` that are not build
phases have been modified not to accept a `spec` and a `prefix`
argument. This permits to leverage the common `configure_args` signature
to insert by default the configuration arguments into the generated
module files. I think it's preferable to handling those packages
differently than `AutotoolsPackage`. Besides only one package seems
to override one of these methods.

* Fixed broken indentation + improved resiliency of refresh

Fixed broken indentation in `spack module refresh` (probably a rebase
gone silently wrong?). Filter the writers for blacklisted specs before
searching for name clashes. An error with a single writer will not
stop regeneration, but instead will print a warning and continue
the command.
2017-09-19 12:34:20 -07:00
Massimiliano Culpo
99fb394ac1 Group Travis CI jobs in stages (#5104)
- This should speed-up Travis CI tests and refers to #5049

- Travis uses build-stages to group tests together
    - The idea is to let fast tests fail first, then move to longer ones.
    - Added external perl to avoid download failure from CPAN and reduce build time
    - Disabling perl-dbi: continues to fail with (504 Gateway Time-out) on Travis

- We now cover all the build systems in tests:
    - Add back `openblas` to Travis as a separate package.
    - Switched `openblas` for `astyle` to build a simpler MakefilePackage.
    - Added 'tut' (WafPackage)
    - Added 'py-setuptools' (PythonPackage)
    - Added 'perl-dbi' (PerlPackage)
    - Added 'build_systems' directory to the ones for which we get a summary
    - Added 'openjpeg' (CMakePackage)
    - Added 'r-rcpp' (RPackage)
    - Added comments to build tests to show the covered build system
2017-08-19 14:52:27 -07:00
Massimiliano Culpo
c91d18b622 qa: adjust thresholds for acceptance (#3105) 2017-02-09 08:31:57 -08:00
Massimiliano Culpo
28b7ef3175 codecov: added commit status, made green a reachable state (#3051) 2017-02-07 18:25:38 -08:00
Todd Gamblin
3b2124af6a Turn off codecov comments (use only statuses) 2017-01-26 02:21:26 -08:00
Todd Gamblin
a5700a8888 Use codecov for coverage instead of coveralls (#2933)
* Switch from coveralls to codecov

- Add .codecov.yml, simplify .travis.yml
- Add codecov badge to README.md

* Add tests for spack graph.
2017-01-26 02:19:35 -08:00