Tests complaining about invalid directory

When I am trying to test the code in avogadrolibs it is showing errors like this.


I thought it was not able to find the path so I tried absolute path, but still the same error for arraytest.cpp

You’ll need to be a bit more clear about how you’ve set up your build. Much like the rest of the code, the tests are set up to find the avogadro source directory automatically.

Can you post, for example, the avogadrolibs/CMakeCache.txt file?

What version of cmake are you using?

CMakeCache.txt (13.1 KB)
Untitled

Are you building in the same directory as the source?

# For build in directory: /home/vaishnavi/openchemistry/avogadrolibs

You also don’t seem to have set up Qt:
Qt5_DIR:PATH=Qt5_DIR-NOTFOUND

Actually I was using this command

cmake -DQT_VERSION=6 -DBUILD_MOLEQUEUE=OFF -DCMAKE_BUILD_TYPE=Release -S ./openchemistry -B ./build
to build from /home/vaishnavi
but for testing I was building from
openchemistry/avogadrolibs/tests/core

First off, if you’re using Qt6, the tests haven’t been migrated. (I merged a recent change that skips them.)

But the reason you’re running into that particular error is that you’re trying to run the tests from the source directory, not the build directory. You build into ./build then you can run tests from ./build/avogadrolibs/tests for example.

Anyway, as I mentioned, at the moment the tests are Qt5-only. If you want to help update them, I’d be happy to provide some pointers.

Yes I would love to help in updating them.

1 Like

I was trying to figure out how tests can be updated to Qt6, should I start by updating CMakeLists.txt?

@ghutchis I was also unable to compile Avogadro with tests, even with Qt5. Would you mind giving a quick explanation as to how it’s meant to be done?

In particular:

  1. Is using the -DENABLE_TESTING CMake flag all that is necessary?
  2. Does it matter if you build in release mode or debug mode?
  1. Yes. Use the top-level -DENABLE_TESTING flag.
  2. No, although if you’re using the various sanitizer builds, you probably want Debug mode.

Yes. Right now tests/CMakeLists.txt explicitly excludes Qt6:

if(USE_QT AND QT_VERSION EQUAL 5)
  add_subdirectory(qtgui)
endif()

If you change that, you’ll need to start updating pieces in tests/qtgui/CMakeLists.txt and the tests/qtgui/*.cpp files too.

I have made changes in cmake and corresponding cpp files for avogadrolibs to update tests to Qt6. Please review and provide your valuable feedback.

1 Like

Thanks - I’ll take a look soon