BUG: Some tests using `scripts:` non-functional on windows
There are situations where the package_contents tests are not applicable (especially because file exclusion isn't implemented yet).
In https://github.com/conda-forge/zlib-feedstock/pull/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.
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 :)
Can't reproduce right now because I'm running into https://github.com/prefix-dev/rattler-build/issues/1054 during the zlib build, now also on x64.
@zelosleone when you have time, can you make a very small reproducer and see if this is true?
Some thing like should fail (as there is no zlib.dll).
package:
name: foobar
version: "0.1.0"
tests:
- script:
- if not exist %LIBRARY_BIN%\zlib.dll exit 1
@zelosleone when you have time, can you make a very small reproducer and see if this is true?
Some thing like should fail (as there is no
zlib.dll).package: name: foobar version: "0.1.0"
tests:
- script:
- if not exist %LIBRARY_BIN%\zlib.dll exit 1
Was not able to reproduce this at all with the same recipe, tried different dll names (with dummy ones too) with different if/else conditions too just in case
I am not sure I understand. You want to test that
zlib.dllis 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 :)
Just in case, both checking zlib.dll is there or checking its not there works correctly. with if not exist %LIBRARY_BIN%\zlib.dll exit 1 and if exist %LIBRARY_BIN%\zlib.dll exit 1
Let's close this issue then.