opencog / asmoses

MOSES Machine Learning: Meta-Optimizing Semantic Evolutionary Search for the AtomSpace (https://github.com/opencog/atomspace)
https://wiki.opencog.org/w/Meta-Optimizing_Semantic_Evolutionary_Search
Other
39 stars 31 forks source link

Fix unit tests #87

Closed Habush closed 3 years ago

Habush commented 3 years ago

This PR has made the following changes:

linas commented 3 years ago

FYI, in either this or a distinct PR, I believe that much of the CMakefile can be cut away ... the python/cython parts appear to be duplicating what is already done in the earlier line

include(OpenCogFindPython)

This file can be found in the cogutils git repo, under /cmake/OpenCogFindPython.cmake

Habush commented 3 years ago

ReductRulesUTest fails in CircleCI. And the reason is a new atom type - ReducedTo - is introduced in the urereduct module, which the test is written for. The unit-test imports (opencog reduct) before executing the test. Hence, for it to pass, we have to add a configuration step in the CircleCI config file for it to install asmoses before running the tests.

linas commented 3 years ago

install asmoses before running the tests.

Well, there is this rather stunningly complicated block of code that is supposed to avoid the need for this. I rather hated it when it was first added, because it was really complicated. Since then, I have had to spend about 1-3 hours for each new project, to figure out how to configure it for that project. The problem is that it requires 3 or 5 different declarations within 2 or 3 different CMakefiles, done so that exactly the same module name is used in each file, plus some extra shims in your reduct.scm file that has to match what's in the CMakefiles. The names of the things you have to configure aren't obvious, and the whole thing is undocumented. Getting about half this stuff wired up right is not hard, but getting all of it right is mind-bendingly hard. Maybe it should be documented.

Just saying -- it can be done, but I don't expect you to do it, and just saying "make install" before running tests is just fine by me.

linas commented 3 years ago

Part 2 of above comment: as an example, look at atomspace-rocks for a working version. One of the CMakefiles looks like this:


DECLARE_GUILE_CONFIG_TARGET(SCM_CONFIG "opencog rocks-config" "OPENCOG_TEST")

ADD_SUBDIRECTORY (persist)

ADD_GUILE_MODULE (FILES
   scm/persist-rocks.scm
   MODULE_DESTINATION "${GUILE_SITE_DIR}/opencog"
)

WRITE_GUILE_CONFIG(${GUILE_BIN_DIR}/opencog/rocks-config.scm SCM_CONFIG TRUE)

WRITE_GUILE_CONFIG(${GUILE_BIN_DIR}/opencog/rocks-config-installable.scm SCM_CONFIG FALSE)
INSTALL(FILES ${GUILE_BIN_DIR}/opencog/rocks-config-installable.scm DESTINATION ${GUILE_SITE_DIR}/opencog RENAME rocks-config.scm)

The above is enough to get you started, but its not enough to make everything work. I'm not sure what else is needed, you have to grep around in the code, and also look at the scripts that cogutils provide.

I'm half-tempted to rip this stuff out and throw it away, but since it does work when configured properly... I dunno. I guess it can stay. It's just .. much too complicated.

ngeiswei commented 3 years ago

For now it's acceptable to install before testing, ideally this can be fixed later on.