Uploaded image for project: 'MariaDB Connector/C++'
  1. MariaDB Connector/C++
  2. CONCPP-102

Option to Disable Tests during Production Build

Details

    • Task
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • None
    • 1.0.3, 1.1.3
    • General
    • None

    Description

      Hi, could there be an option to enable/disable tests being built?
      Like here
      https://stackoverflow.com/questions/41737494/cmake-how-to-separately-compile-production-code-and-test-code

      Attachments

        Activity

          Thank you for your report. I actually expected, that such option exists, since our other connectors usually have it, but it does not. I will add the option to suppress tests build. Not sure about only tests building - they are linked against the connector library.

          As a workaround - you can simply remove test/CMakeLists.txt before running cmake. cmake should still normally execute, but test targets won't be created.

          Lawrin Lawrin Novitsky added a comment - Thank you for your report. I actually expected, that such option exists, since our other connectors usually have it, but it does not. I will add the option to suppress tests build. Not sure about only tests building - they are linked against the connector library. As a workaround - you can simply remove test/CMakeLists.txt before running cmake. cmake should still normally execute, but test targets won't be created.

          I guess removing the whole test directory will have the same effect.

          Lawrin Lawrin Novitsky added a comment - I guess removing the whole test directory will have the same effect.

          yes, but it makes the git tree dirty, which is annoying.
          you don't even have to remove the whole test folder, just the CMakeList in the test folder, and then it won't build test.
          But a cmake flag would be a lot cleaner and standard

          aronwk Aaron Kimbrell added a comment - yes, but it makes the git tree dirty, which is annoying. you don't even have to remove the whole test folder, just the CMakeList in the test folder, and then it won't build test. But a cmake flag would be a lot cleaner and standard

          As I said - it's only a workaround. And removing CMakeLists.txt only was my first variant.

          Lawrin Lawrin Novitsky added a comment - As I said - it's only a workaround. And removing CMakeLists.txt only was my first variant.

          Added WITH_UNIT_TESTS option with default value ON to control if tests should be built.
          Also added BUILD_TESTS_ONLY option(OFF) - it does what its names say. It just looked to be useful at least for me
          Not sure if it makes sense to talk about fix version, but it will appear in source packages beginning from mentioned version - so, there is some sense

          Lawrin Lawrin Novitsky added a comment - Added WITH_UNIT_TESTS option with default value ON to control if tests should be built. Also added BUILD_TESTS_ONLY option(OFF) - it does what its names say. It just looked to be useful at least for me Not sure if it makes sense to talk about fix version, but it will appear in source packages beginning from mentioned version - so, there is some sense

          People

            Lawrin Lawrin Novitsky
            aronwk Aaron Kimbrell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.