Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Some tests using scripts: non-functional on windows #1152

Open
h-vetinari opened this issue Nov 2, 2024 · 2 comments
Open

BUG: Some tests using scripts: non-functional on windows #1152

h-vetinari opened this issue Nov 2, 2024 · 2 comments

Comments

@h-vetinari
Copy link

h-vetinari commented Nov 2, 2024

There are situations where the package_contents tests are not applicable (especially because file exclusion isn't implemented yet).

In conda-forge/zlib-feedstock#83, I currently have

     tests:
      - script:
        - if: unix
          then:
            - test ! -f ${PREFIX}/lib/libz.a
            - test ! -f ${PREFIX}/lib/libz${SHLIB_EXT}
            - test ! -f ${PREFIX}/include/zlib.h
          else:
            - if not exist %LIBRARY_BIN%\zlib.dll exit 1
            - if not exist %PREFIX%\zlib.dll exit 1

During the build (logs) on windows, we see that the file we're testing for is definitely there,

 │ │ Files in package:
 │ │   - Library/bin/zlib.dll
 │ │   - zlib.dll
 │ │   - info/[...]

but the test fails

 │ │ │ (base) %SRC_DIR%>if not exist D:\bld\bld\rattler-build_libzlib_1730506967\work\test\Library\bin\zlib.dll exit 1 
 │ │ │ × error Script failed with status 1

I understand that the positive tests can be formulated as

tests:
  - package_contents:
      files:

but what worries me far more is that anything under tests: scripts: produces false positives or negatives. If we can't trust that correctly specified, benign-looking tests are executed correctly (and doubly so if they're working under conda-build), we're blocked from migrating at scale.

@h-vetinari h-vetinari changed the title Some tests using scripts: non-functional (both false positive & false negatives) BUG: Some tests using scripts: non-functional on windows Nov 2, 2024
@wolfv
Copy link
Member

wolfv commented Nov 2, 2024

I am not sure I understand. You want to test that zlib.dll is NOT there?

Would you be able to make a small reproducer? Are you sure that your condition is correct in the windows test? It looks to me like you are testing the inverse of the unix tests here (on one you test for non-existence, and on the other for existence).

We are just executing the script as given, with a few env vars. No big magic involved :)

@h-vetinari
Copy link
Author

Can't reproduce right now because I'm running into #1054 during the zlib build, now also on x64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants