Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cpp tests #85

Open
dimalvovs opened this issue Mar 13, 2024 · 2 comments · May be fixed by #117
Open

Cpp tests #85

dimalvovs opened this issue Mar 13, 2024 · 2 comments · May be fixed by #117

Comments

@dimalvovs
Copy link
Contributor

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
Copy link
Contributor Author

dimalvovs commented Sep 30, 2024

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
Copy link
Contributor Author

dimalvovs commented Sep 30, 2024

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 dimalvovs linked a pull request Sep 30, 2024 that will close this issue
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 a pull request may close this issue.

1 participant