CoGAPS icon indicating copy to clipboard operation
CoGAPS copied to clipboard

Cpp tests

Open dimalvovs opened this issue 1 year ago • 2 comments

There are tests in the https://github.com/FertigLab/CoGAPS/tree/master/src/cpp_tests, but we seem to have lost the knowledge of how up to date those are and do those work at all. Are the tests being run at compile time? How do we run them on-demand? Are a lot of tests missing?

dimalvovs avatar Mar 13 '24 17:03 dimalvovs

It looks that tests are not enabled by default

To enable the tests, one should launch configure with the --enable-cpp-tests

However, it is not clear how to pass such parameter to the compiler during installation.

It is possible to create a new configure through running autoconf --enable-cpp-flags, but it will anyway be rewritten at the time of compilation (for example during devtools::install), which results in tests not being compiled.

dimalvovs avatar Sep 30 '24 20:09 dimalvovs

It looks that one promising way to enable cpp tests is to pass the configure argument like that

devtools::install(args = "--configure-args='--enable-cpp-tests'")

although when such flag is passed, installation results in the following errors

clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=0 -DGAPS_DISABLE_CHECKPOINTS -D__GAPS_R_BUILD__ -DGAPS_CPP_UNIT_TESTS  -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/BH/include' -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2   -c cpp_tests/testVector.cpp -o cpp_tests/testVector.o
cpp_tests/testVector.cpp:53:9: error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
        REQUIRE(v.size() == 100);
        ^
cpp_tests/catch.h:11484:25: note: expanded from macro 'REQUIRE'
#define REQUIRE( expr ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, expr  )
                        ^
cpp_tests/catch.h:2160:9: note: expanded from macro 'INTERNAL_CATCH_TEST'
        INTERNAL_CATCH_REACT( __catchResult ) \
        ^
cpp_tests/catch.h:2144:44: note: expanded from macro 'INTERNAL_CATCH_REACT'
    if( resultBuilder.shouldDebugBreak() ) CATCH_BREAK_INTO_DEBUGGER(); \
                                           ^
cpp_tests/catch.h:2080:75: note: expanded from macro 'CATCH_BREAK_INTO_DEBUGGER'
    #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
                                                                          ^
cpp_tests/catch.h:2058:38: note: expanded from macro 'CATCH_TRAP'
        #define CATCH_TRAP() __asm__("int $3\n" : : /* NOLINT */ )
                                     ^
<inline asm>:1:2: note: instantiated into assembly here
        int $3
        ^

this seems to be related with an outdated catch version (which is redistributed with CoGAPS)

dimalvovs avatar Sep 30 '24 21:09 dimalvovs