Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Jan 31, 2025
1 parent d0b1c94 commit 005d558
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 91 deletions.
125 changes: 84 additions & 41 deletions tests/test-recipes/metadata/_blas_pins/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,85 @@
c_compiler: # [win]
- clang # [win]
cxx_compiler: # [win]
- clangxx # [win]
blas_default_impl: # [linux64]
- openblas # [linux64]
blas_impl: # [linux64]
- blis # [linux64]
blas_impl_lib: # [linux64]
- libblis.so.4 # [linux64]
c_compiler: # [linux64]
- gcc # [linux64]
c_compiler_version: # [linux64]
- '13' # [linux64]
c_stdlib: # [linux64]
- sysroot # [linux64]
c_stdlib_version: # [linux64]
- '2.17' # [linux64]
cdt_name: # [linux64]
- conda # [linux64]
channel_sources: # [linux64]
- conda-forge # [linux64]
channel_targets: # [linux64]
- conda-forge main # [linux64]
docker_image: # [linux64]
- quay.io/condaforge/linux-anvil-x86_64:alma9 # [linux64]
fortran_compiler: # [linux64]
- gfortran # [linux64]
fortran_compiler_version: # [linux64]
- '13' # [linux64]
libblas: # [linux64]
- 3.9.* *netlib # [linux64]
libcblas: # [linux64]
- 3.9.* *netlib # [linux64]
liblapack: # [linux64]
- 3.9.* *netlib # [linux64]
liblapacke: # [linux64]
- 3.9.* *netlib # [linux64]
mkl: # [linux64]
- '2024' # [linux64]
target_platform: # [linux64]
- linux-64 # [linux64]
zip_keys: # [linux64]
- - blas_impl # [linux64]
- blas_impl_lib # [linux64]
- - c_compiler_version # [linux64]
- fortran_compiler_version # [linux64]

blas_impl:
- openblas
- openblas # [win]
- mkl # [x86_64 and not osx]
- blis # [x86_64]
- accelerate # [osx]

blas_impl_lib:
- libopenblas.so.0 # [linux]
- libopenblas.0.dylib # [osx]
- openblas.dll # [win]
- openblas.dll # [win]

- libmkl_rt.so # [linux64]
- mkl_rt.2.dll # [win64]

- libblis.so.4 # [linux64]
- libblis.4.dylib # [osx and x86_64]
- libblis.4.dll # [win64]

- libvecLibFort-ng.dylib # [osx]

blas_default_impl:
- openblas # [not win]
- mkl # [win]

openblas_type: # [win]
- openmp # [win]
- pthreads # [win]
- dummy # [win]
- dummy # [win]

zip_keys:
-
- blas_impl
- blas_impl_lib
- openblas_type # [win]
blas_default_impl: # [aarch64]
- openblas # [aarch64]
blas_impl: # [aarch64]
- openblas # [aarch64]
blas_impl_lib: # [aarch64]
- libopenblas.so.0 # [aarch64]
c_compiler: # [aarch64]
- gcc # [aarch64]
c_compiler_version: # [aarch64]
- '13' # [aarch64]
c_stdlib: # [aarch64]
- sysroot # [aarch64]
c_stdlib_version: # [aarch64]
- '2.17' # [aarch64]
cdt_name: # [aarch64]
- conda # [aarch64]
channel_sources: # [aarch64]
- conda-forge # [aarch64]
channel_targets: # [aarch64]
- conda-forge main # [aarch64]
docker_image: # [aarch64]
- quay.io/condaforge/linux-anvil-x86_64:alma9 # [aarch64]
fortran_compiler: # [aarch64]
- gfortran # [aarch64]
fortran_compiler_version: # [aarch64]
- '13' # [aarch64]
libblas: # [aarch64]
- 3.9.* *netlib # [aarch64]
libcblas: # [aarch64]
- 3.9.* *netlib # [aarch64]
liblapack: # [aarch64]
- 3.9.* *netlib # [aarch64]
liblapacke: # [aarch64]
- 3.9.* *netlib # [aarch64]
target_platform: # [aarch64]
- linux-aarch64 # [aarch64]
zip_keys: # [aarch64]
- - blas_impl # [aarch64]
- blas_impl_lib # [aarch64]
- - c_compiler_version # [aarch64]
- fortran_compiler_version # [aarch64]
61 changes: 11 additions & 50 deletions tests/test-recipes/metadata/_blas_pins/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ package:
version: "{{ version }}"

source:
- url: https://github.com/Reference-LAPACK/lapack/archive/v{{ version }}.tar.gz
- url: https://removed-to-trigger-error.com/Reference-LAPACK/lapack/archive/v{{ version }}.tar.gz
sha256: 106087f1bb5f46afdfba7f569d0cbe23dacb9a07cd24733765a0e89dbe1ad573

- url: https://github.com/isuruf/vecLibFort/archive/99af8640e98c829b41c3235e3706760cd5696fe4.tar.gz
sha256: 80de7c6e83d1d84d016b4cb299f2c15f5a82b9d36865dd5c16bf221fe9a303ad
folder: vecLibFort

build:
number: "{{ build_num }}"

Expand All @@ -38,7 +34,6 @@ requirements:
- {{ compiler("fortran") }}
- cmake
- make # [not win]
- ninja # [win]
# The following are actual build dependencies of this recipe; however, they
# only get installed by the build scripts, since they must be installed in a
# different environment (otherwise there'd be a variant collision)! The build
Expand All @@ -54,8 +49,6 @@ requirements:

outputs:
- name: libblas
script: build_pkg.sh # [unix]
script: build_pkg.bat # [win]
build:
string: {{ build_num }}_h{{ PKG_HASH }}_{{ blas_impl }}
run_exports:
Expand Down Expand Up @@ -86,10 +79,7 @@ outputs:
- blas {{ blas_major }}.{{ blas_minor }} {{ blas_impl }}
files:
- lib/libblas.so # [linux]
- lib/libblas.dylib # [osx]
- lib/libblas.so.{{ version_major }} # [linux]
- lib/libblas.{{ version_major }}.dylib # [osx]
- Library/bin/libblas.dll # [win]
- lib/libvecLibFort-ng.dylib # [blas_impl == 'accelerate']
- lib/liblapack-netlib.*.dylib # [blas_impl == 'accelerate']
- lib/liblapacke-netlib.*.dylib # [blas_impl == 'accelerate']
Expand All @@ -100,12 +90,9 @@ outputs:
# Following line is just to help conda-build's used variables detection
- echo hello # [blas_impl_lib == 'blas']
- test -f $PREFIX/lib/libblas.so.{{ version_major }} # [linux]
- test -f $PREFIX/lib/libblas.{{ version_major }}.dylib # [osx]
- if not exist %LIBRARY_BIN%/libblas.dll exit 1 # [win]

- name: libcblas
script: build_pkg.sh # [unix]
script: build_pkg.bat # [win]
# script: build_pkg.sh # [unix]
build:
string: {{ build_num }}_h{{ PKG_HASH }}_{{ blas_impl }}
run_exports:
Expand All @@ -127,19 +114,13 @@ outputs:
- blas {{ blas_major }}.{{ blas_minor }} {{ blas_impl }}
files:
- lib/libcblas.so # [linux]
- lib/libcblas.dylib # [osx]
- lib/libcblas.so.{{ version_major }} # [linux]
- lib/libcblas.{{ version_major }}.dylib # [osx]
- Library/bin/libcblas.dll # [win]
test:
commands:
- test -f $PREFIX/lib/libcblas.so.{{ version_major }} # [linux]
- test -f $PREFIX/lib/libcblas.{{ version_major }}.dylib # [osx]
- if not exist %LIBRARY_BIN%/libcblas.dll exit 1 # [win]

- name: liblapack
script: build_pkg.sh # [unix]
script: build_pkg.bat # [win]
# script: build_pkg.sh # [unix]
build:
skip: true # [blas_impl == 'blis']
string: {{ build_num }}_h{{ PKG_HASH }}_{{ blas_impl }}
Expand All @@ -161,19 +142,13 @@ outputs:
- blas {{ blas_major }}.{{ blas_minor }} {{ blas_impl }}
files:
- lib/liblapack.so # [linux]
- lib/liblapack.dylib # [osx]
- lib/liblapack.so.{{ version_major }} # [linux]
- lib/liblapack.{{ version_major }}.dylib # [osx]
- Library/bin/liblapack.dll # [win]
test:
commands:
- test -f $PREFIX/lib/liblapack.so.{{ version_major }} # [linux]
- test -f $PREFIX/lib/liblapack.{{ version_major }}.dylib # [osx]
- if not exist %LIBRARY_BIN%/liblapack.dll exit 1 # [win]

- name: liblapacke
script: build_pkg.sh # [unix]
script: build_pkg.bat # [win]
# script: build_pkg.sh # [unix]
build:
skip: true # [blas_impl == 'blis']
string: {{ build_num }}_h{{ PKG_HASH }}_{{ blas_impl }}
Expand All @@ -196,19 +171,14 @@ outputs:
- blas {{ blas_major }}.{{ blas_minor }} {{ blas_impl }}
files:
- lib/liblapacke.so # [linux]
- lib/liblapacke.dylib # [osx]
- lib/liblapacke.so.{{ version_major }} # [linux]
- lib/liblapacke.{{ version_major }}.dylib # [osx]
- Library/bin/liblapacke.dll # [win]
test:
commands:
- test -f $PREFIX/lib/liblapacke.so.{{ version_major }} # [linux]
- test -f $PREFIX/lib/liblapacke.{{ version_major }}.dylib # [osx]
- if not exist %LIBRARY_BIN%/liblapacke.dll exit 1 # [win]

- name: blas-devel
# uses lapack {{ version }}, not {{ blas_major }}
script: install_blas_devel.sh # [unix]
# script: install_blas_devel.sh # [unix]
build:
string: {{ build_num }}_h{{ PKG_HASH }}_{{ blas_impl }}
requirements:
Expand All @@ -232,22 +202,16 @@ outputs:
commands:
- test -f $PREFIX/lib/pkgconfig/blas.pc # [unix and blas_impl == "openblas"]
- test -f $PREFIX/lib/liblapack.so # [linux]
- test -f $PREFIX/lib/liblapack.dylib # [osx]
- test -f $PREFIX/lib/liblapacke.so # [linux]
- test -f $PREFIX/lib/liblapacke.so.{{ version_major }} # [linux]
- test -f $PREFIX/lib/liblapacke.dylib # [osx]
- test -f $PREFIX/lib/liblapacke.{{ version_major }}.dylib # [osx]
- if not exist %LIBRARY_BIN%/liblapack.dll exit 1 # [win]
- if not exist %LIBRARY_BIN%/liblapacke.dll exit 1 # [win]

# For compatiblity
- name: blas
version: "{{ blas_major }}.{{ blas_minor }}"
script: test_blas.sh # [unix]
script: test_blas.bat # [win]
# script: test_blas.sh # [unix]
build:
string: {{ blas_impl }}
activate_in_script: True
# activate_in_script: True
ignore_run_exports_from:
# this is a metapackage; ignore the run-exports from the build environment
- {{ stdlib("c") }}
Expand All @@ -260,7 +224,6 @@ outputs:
- {{ compiler("c") }}
- {{ compiler("fortran") }}
- cmake
- ninja # [win]
- llvm-openmp # [linux and ((blas_impl == "openblas") or (blas_impl == "mkl"))]
host:
- blas-devel {{ version }} {{ build_num }}*_{{ blas_impl }}
Expand All @@ -270,17 +233,15 @@ outputs:
commands:
- test -f $PREFIX/lib/liblapacke.so # [linux]
- test -f $PREFIX/lib/liblapacke.so.{{ version_major }} # [linux]
- test -f $PREFIX/lib/liblapacke.dylib # [osx]
- test -f $PREFIX/lib/liblapacke.{{ version_major }}.dylib # [osx]
- if not exist %LIBRARY_BIN%/liblapacke.dll exit 1 # [win]

about:
home: https://github.com/conda-forge/blas-feedstock
license: BSD-3-Clause
license_file:
- LICENSE.txt
- {{ blas_impl }}_license.txt # [win]
summary: Metapackage to select the BLAS variant. Use conda's pinning mechanism in your environment to control which variant you want.
- LICENSE
summary: >-
Metapackage to select the BLAS variant.
Use conda's pinning mechanism in your environment to control which variant you want.
extra:
recipe-maintainers:
Expand Down
17 changes: 17 additions & 0 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2102,3 +2102,20 @@ def test_api_build_inject_jinja2_vars_on_first_pass(testing_config):

testing_config.variant = {"python_min": "3.12"}
api.build(recipe_dir, config=testing_config)


@pytest.mark.skipif(not on_linux, reason="One platform is enough")
def test_build_strings_glob_match(testing_config: Config) -> None:
"""
Test issues observed in:
- https://github.com/conda/conda-build/issues/5571#issuecomment-2605223563
- https://github.com/conda-forge/conda-smithy/pull/2232#issuecomment-2618825581
- https://github.com/conda-forge/blas-feedstock/pull/132
- https://github.com/conda/conda-build/pull/5600
"""
testing_config.channel_urls = ["conda-forge"]
with pytest.raises(RuntimeError, match="Could not download"):
# We expect an error fetching the license because we added a bad path on purpose
# so we don't start the actual build. However, this is enough to get us through
# the multi-output render phase where we examine compatibility of pins.
api.build(metadata_path / "_blas_pins", config=testing_config)

0 comments on commit 005d558

Please sign in to comment.