Skip to content

Conversation

mschofie
Copy link

Fixes #3285.

ONNX_MLIR_BUILD_TESTS is documented as controlling whether the test executables are built. But it doesn't appear to be honored - even when I set it to OFF, the tests are still built. The problem appears to be with the use of EXCLUDE_FROM_ALL - when attempting to opt-out of tests, the CMake variable EXCLUDE_FROM_ALL is set to ON - however CMake only documents EXCLUDE_FROM_ALL properties applied to Directories (documentation) or Targets (documentation). This change:

  1. Updates the logic that tests ONNX_MLIR_BUILD_TESTS to set the EXCLUDE_FROM_ALL property on the current Directory.
  2. Moves the check from :/test/multiple-models/CMakeLists.txt up to :/test/CMakeLists.txt to apply to all of :/test

I've validated with "Ninja Multi-Config" and "Visual Studio 17 2022" generators on Windows. Without the fix, running a CMake build with no target specified, and ONNX_MLIR_BUILD_TESTS set to OFF will build the test targets. With the fix, the test targets aren't built by default, but will build when a target is specifically requested.

@jenkins-droid
Copy link
Collaborator

Can one of the admins verify this patch?

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

Successfully merging this pull request may close these issues.

ONNX_MLIR_BUILD_TESTS doesn't appear to be honored
2 participants