Closed vissarion closed 3 years ago
This is part of this JOSS review openjournals/joss-reviews#3255
A test suite has been added.
Tests of data structures, file-io, algorithms, and visualization techniques are automatic. Model/element picking functionalities require minimum user input (e.g., clicking on the model).
Thanks, please add some explanation for how the user can run those tests, e.g. in the README after the "build" section.
Thanks for the comments. I've added a 'Test' section after 'Build':
Test
A test-suite is provided in the
tests
subfolder, which contains a collection of automated test cases (for data structures, IO, algorithms, visualization, etc.) and some semi-automated test cases (for GUI-related functionalities that require interactive user input). You can build and run thetests
executable file to quickly test Easy3D on your machine.
Besides, I've also added a 'Repository layout' before 'Build'. I think this will be helpful for users.
Repository layout
The repository contains a
CMakeLists.txt
file that serves as anchor for configuring and building programs, and a set of subfolders:
3rd_party
- source code of third party librariesapplications
- applications built on top of Easy3Dcmake
- CMake-related configuration filesdocs
- documentation configuration file (Doxygen)easy3d
- source code of Easy3Dresources
- test data, images, shaders, and textures, etc.tests
- a collection of test cases
I am getting the following error when I try to build tests
ThinkPad-T490:~/workspace/Easy3D/tests$ cmake .
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/workspace/Easy3D/tests
ThinkPad-T490:~/workspace/Easy3D/tests$ make
[ 1%] Building CXX object CMakeFiles/tests.dir/graph.cpp.o
/home/workspace/Easy3D/tests/graph.cpp:25:10: fatal error: easy3d/core/graph.h: No such file or directory
25 | #include <easy3d/core/graph.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/tests.dir/build.make:82: CMakeFiles/tests.dir/graph.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/tests.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
I guess you were using the CMakeList file at the tests
subdirectory?
Could you please download the entire code and use the main CMakeList file
in the root directory? I will clarify this in ReadMe.
Building works with the root CMakeList
file but there is no explanation of how to run the tests. Please add this also in README
I've added the following:
To build and run the test suite, download the entire source tree, use
CMakeLists.txt
in the root directory of the repository, switch on the CMake optionEASY3D_BUILD_TESTS
, and run CMake. After CMake, you can build all or only thetests
executable. Finally, you can run thetests
executable for the test.
Cloning from scratch I tried
mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release -DEASY3D_BUILD_TESTS=On ..
make
to get
[ 87%] Building CXX object tests/CMakeFiles/tests.dir/linear_solvers.cpp.o
In file included from /home/vissarion/workspace/Easy3D/easy3d/core/types.h:31,
from /home/vissarion/workspace/Easy3D/tests/linear_solvers.cpp:26:
/home/vissarion/workspace/Easy3D/easy3d/core/vec.h: In instantiation of ‘easy3d::Vec<N, T>::thisclass& easy3d::Vec<N, T>::operator=(const thisclass&) [with long unsigned int N = 6; T = double; easy3d::Vec<N, T>::thisclass = easy3d::Vec<6, double>]’:
/home/vissarion/workspace/Easy3D/easy3d/core/mat.h:1274:16: required from ‘void easy3d::lu_back_substitution(const easy3d::Mat<N, N, T>&, const easy3d::Vec<N, T>&, const easy3d::Vec<N, T>&, easy3d::Vec<N, T>*) [with long unsigned int N = 6; T = double]’
/home/vissarion/workspace/Easy3D/tests/linear_solvers.cpp:72:42: required from here
/home/vissarion/workspace/Easy3D/easy3d/core/vec.h:85:19: error: ‘memcpy’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
85 | memcpy(data_, rhs.data(), N*sizeof(T));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:461,
from /usr/include/x86_64-linux-gnu/c++/9/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/9/bits/c++config.h:524,
from /usr/include/c++/9/cstdint:38,
from /home/vissarion/workspace/Easy3D/easy3d/core/types.h:28,
from /home/vissarion/workspace/Easy3D/tests/linear_solvers.cpp:26:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:31:1: note: ‘void* memcpy(void*, const void*, size_t)’ declared here, later in the translation unit
31 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
| ^~~~~
make[2]: *** [tests/CMakeFiles/tests.dir/build.make:95: tests/CMakeFiles/tests.dir/linear_solvers.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3868: tests/CMakeFiles/tests.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
Solved by adding a missing #include <cstring>
. On Mac it was not required: the C++ standard library is messy on Mac.
It should work now.
Ok thanks, I created a PR https://github.com/LiangliangNan/Easy3D/pull/85 to add CI builds to make sure that your package builds after every commit.
It is minimal in the sense that only supports gcc
on ubuntu
and only builds without testing since tests involve user interaction which is difficult to automate. This could be extended to build on different platforms and compilers as well as include a minimal test suite with not interactions. But this could be done in the future or left as a good-first-issue
for new contributors.
This is great. Thanks!
A test-suite is either missing or not easy to find. I couldn't find instructions on how to build and run tests manually.
There is only a directory
tests
that you can build some tests and tutorials.