conda / conda-build

Commands and tools for building conda packages
https://docs.conda.io/projects/conda-build/
Other
384 stars 425 forks source link

Compiler activation in test section suppresses test output on windows #4605

Open h-vetinari opened 2 years ago

h-vetinari commented 2 years ago

I've noticed this a couple of times, that when a compiler is added to the test section on windows, the output generated by the individual commands: will not be shown in the build log. This makes debugging quite a bit harder, obviously.

For example, given a test section:

    test:
      requires:
        - pkg-config
      commands:
      {% for each_lib in absl_libs %}
        - test -f $PREFIX/lib/libabsl_{{ each_lib }}${SHLIB_EXT}      # [unix]
        - if not exist %LIBRARY_LIB%\\absl_{{ each_lib }}.lib exit 1  # [win]

        # pkg-config
        - pkg-config --print-errors --exact-version "{{ v_major }}" absl_{{ each_lib }}
      {% endfor %}

        # pkg-config (abseil_dll)
        - pkg-config --print-errors --exact-version "{{ v_major }}" abseil_dll  # [win]

this works as expected, producing something along the lines of [removed useless lines]":

set PREFIX=D:\bld\abseil-split_1666391424669\_test_env
set SRC_DIR=D:\bld\abseil-split_1666391424669\test_tmp
(base) %SRC_DIR%>call "%SRC_DIR%\conda_test_env_vars.bat" 
(base) %SRC_DIR%>set "CONDA_SHLVL="   && 
(base) %SRC_DIR%>conda activate "%PREFIX%" 
(%PREFIX%) %SRC_DIR%>call "%SRC_DIR%\run_test.bat"
(%PREFIX%) %SRC_DIR%>if not exist %PREFIX%\Library\lib\\absl_flags.lib exit 1
(%PREFIX%) %SRC_DIR%>pkg-config --print-errors --exact-version "20220623" absl_flags
[...]
(%PREFIX%) %SRC_DIR%>if not exist %PREFIX%\Library\lib\\absl_time_zone.lib exit 1
(%PREFIX%) %SRC_DIR%>pkg-config --print-errors --exact-version "20220623" absl_time_zone
(%PREFIX%) %SRC_DIR%>exit /B 0

Resource usage statistics from testing libabseil-static:

But when we then add something along the lines of

--- a/recipe/meta.yaml
+++ b/recipe/meta.yaml
@@ -68,7 +68,11 @@ outputs:

     test:
       requires:
+        - {{ compiler('cxx') }}
+        - cmake
         - pkg-config
+      files:
+        - cmake_test/
       commands:
       {% for each_lib in absl_libs %}
         - test -f $PREFIX/lib/libabsl_{{ each_lib }}${SHLIB_EXT}      # [unix]
@@ -94,6 +96,11 @@ outputs:
         - pkg-config --print-errors --exact-version "{{ v_major }}" absl_{{ each_lib }}
       {% endfor %}

+        # CMake integration
+        - cd cmake_test
+        - cmake %CMAKE_ARGS% .  # [win]
+        - cmake $CMAKE_ARGS .   # [unix]

we get

set PREFIX=D:\bld\abseil-split_1666400060430\_test_env
set SRC_DIR=D:\bld\abseil-split_1666400060430\test_tmp
(base) %SRC_DIR%>call "%SRC_DIR%\conda_test_env_vars.bat" 
(base) %SRC_DIR%>set "CONDA_SHLVL="   && 
(base) %SRC_DIR%>conda activate "%PREFIX%" 
%SRC_DIR%>SET DISTUTILS_USE_SDK=1 

[...activation...]

%SRC_DIR%>pushd C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\ 
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise>CALL "VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.29 10.0.22621.0 
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.20
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

and we never actually see the outputs of the commands: section (except if there's an error).

h-vetinari commented 1 year ago

and we never actually see the outputs of the commands: section (except if there's an error).

Sometimes not even that!

In https://github.com/conda-forge/re2-feedstock/pull/66, I'm getting:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>CALL "VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.29 10.0.22621.0 
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.5.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Tests failed for re2-2023.06.01-hf7d2add_0.conda - moving package to D:\bld\broken
github-actions[bot] commented 6 months ago

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

h-vetinari commented 6 months ago

Thanks @jakirkham, was gonna say this isn't stale. :)