sympiler / aggregation

The aggregation repository contains a set of algorithms for grouping vertices of DAGs coming from loop-carried dependencies. For more information see Sympiler website
http://www.sympiler.com/
MIT License
5 stars 5 forks source link

Enable and fix Catch test #8

Closed learning-chip closed 1 year ago

learning-chip commented 1 year ago

Enabling unit test would help capture bugs like #5, and also allow better validation of new functionalities like https://github.com/sympiler/sympiler/issues/7 . This PR is just to enable the existing test sptrsv_tests.cpp; will add more tests in later PRs.

Currently the Catch test target is commented out:

https://github.com/sympiler/aggregation/blob/da104fa343672469f2000efa4285dccb32107370/CMakeLists.txt#L151-L153

Uncommenting the lines leads to compile errors with gcc-11.3:

[ 98%] Building CXX object Catch_tests/CMakeFiles/Catch_tests.dir/sptrsv_tests.cpp.o
In file included from /usr/include/signal.h:328,
                 from /work/Catch_tests/catch.hpp:7712,
                 from /work/Catch_tests/sptrsv_tests.cpp:7:
/work/Catch_tests/catch.hpp:10453:58: error: call to non-'constexpr' function 'long int sysconf(int)'
10453 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /work/Catch_tests/catch.hpp:7712,
                 from /work/Catch_tests/sptrsv_tests.cpp:7:
/usr/include/unistd.h:640:17: note: 'long int sysconf(int)' declared here
  640 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
In file included from /work/Catch_tests/sptrsv_tests.cpp:7:
/work/Catch_tests/catch.hpp:10512:45: error: size of array 'altStackMem' is not an integral constant-expression
10512 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
gmake[2]: *** [Catch_tests/CMakeFiles/Catch_tests.dir/build.make:104: Catch_tests/CMakeFiles/Catch_tests.dir/sptrsv_tests.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:334: Catch_tests/CMakeFiles/Catch_tests.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

Updating to the latest Catch v2.13.10 solves the bug. Still using the single-header v2 branch of Catch, not yet changing to the multi-header v3 branch.

Also changed the include files from Sparse_BLAS_INC to Sparse_TRSV_INC, and Sparse_BLAS_SRC_FILES to Sparse_TRSV_SRC_FILES, since the former is not defined elsewhere even in the parent Sympiler repo.

learning-chip commented 1 year ago

The unit tests should also run within github workflows for automatic CI. Currently only the demo examples get run, which is not sufficient for validating advanced features.

cheshmi commented 1 year ago

Thank you, adding test to the flow was on my long list.