diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f935f3d4..53c37078 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -130,7 +130,7 @@ static_analysis: - tar caf splash-cov.bz2 cov-int - curl --form token=zkRfEWYxyAeJDlYYg9Hkkg --form email=emmanueldurand@gmail.com --form file=@splash-cov.bz2 --form description="Splash" https://scan.coverity.com/builds?project=paperManu%2Fsplash - - apt install -y libpcre3-dev + - DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends libpcre3-dev cppcheck - make static_analysis - mv tests/static_analysis_result.txt ../ only: diff --git a/src/core/imagebuffer.h b/src/core/imagebuffer.h index 56370c94..a44cdb5b 100644 --- a/src/core/imagebuffer.h +++ b/src/core/imagebuffer.h @@ -32,7 +32,7 @@ #include "./config.h" #include "./core/coretypes.h" -#include "./core/resizable_array.h" +#include "./utils/resizable_array.h" namespace Splash { diff --git a/src/core/serialized_object.h b/src/core/serialized_object.h index fd0ac574..127158b5 100644 --- a/src/core/serialized_object.h +++ b/src/core/serialized_object.h @@ -25,7 +25,7 @@ #ifndef SPLASH_SERIALIZED_OBJECT_H #define SPLASH_SERIALIZED_OBJECT_H -#include "./core/resizable_array.h" +#include "./utils/resizable_array.h" namespace Splash { diff --git a/src/core/value.h b/src/core/value.h index d41cca7f..9936ebde 100644 --- a/src/core/value.h +++ b/src/core/value.h @@ -31,8 +31,8 @@ #include #include -#include "./core/resizable_array.h" #include "./utils/dense_deque.h" +#include "./utils/resizable_array.h" namespace Splash { diff --git a/src/sink/sink.h b/src/sink/sink.h index 10004148..c14309d0 100644 --- a/src/sink/sink.h +++ b/src/sink/sink.h @@ -34,8 +34,8 @@ #include "./core/attribute.h" #include "./core/coretypes.h" #include "./core/graph_object.h" -#include "./core/resizable_array.h" #include "./graphics/texture.h" +#include "./utils/resizable_array.h" namespace Splash { diff --git a/src/core/resizable_array.h b/src/utils/resizable_array.h similarity index 100% rename from src/core/resizable_array.h rename to src/utils/resizable_array.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5ce640a1..b2875c3b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -63,18 +63,18 @@ link_directories(${PYTHON_LIBRARY_DIRS}) # # Unit tests (executed through 'make check' or 'make test') # -add_executable(unitTests unitTests.cpp) +add_executable(unitTests unit_tests/unitTests.cpp) target_sources(unitTests PRIVATE - check_attributefunctor.cpp - check_base_object.cpp - check_dense_deque.cpp - check_dense_map.cpp - check_dense_set.cpp - check_resizablearray.cpp - check_serialization.cpp - check_tree.cpp - check_upgrade_configuration.cpp - check_value.cpp + unit_tests/core/attribute.cpp + unit_tests/core/base_object.cpp + unit_tests/core/serializer.cpp + unit_tests/core/tree.cpp + unit_tests/core/value.cpp + unit_tests/utils/dense_deque.cpp + unit_tests/utils/dense_map.cpp + unit_tests/utils/dense_set.cpp + unit_tests/utils/resizable_array.cpp + unit_tests/utils/jsonutils.cpp ) if (NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") @@ -131,7 +131,7 @@ endif() add_custom_command(OUTPUT integration_tests COMMAND if [ ! -d ${CMAKE_CURRENT_SOURCE_DIR}/assets ]; then $(git clone https://gitlab.com/sat-metalab/splash-assets ${CMAKE_CURRENT_SOURCE_DIR}/assets); fi COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/assets && git pull origin master - COMMAND ../src/splash ${CMAKE_CURRENT_SOURCE_DIR}/integrationTests.json + COMMAND ../src/splash ${CMAKE_CURRENT_SOURCE_DIR}/integration_tests/integrationTests.json DEPENDS splash ) add_custom_target(check_integration DEPENDS integration_tests) @@ -140,15 +140,14 @@ add_custom_target(check_integration DEPENDS integration_tests) # Static analysis through CppCheck # add_custom_command(OUTPUT cppcheck_analysis - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_cppcheck.sh - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/cppcheck/cppcheck --enable=warning,performance,unusedFunction --project=${CMAKE_CURRENT_BINARY_DIR}/../compile_commands.json 2> ${CMAKE_CURRENT_BINARY_DIR}/static_analysis_result.txt + COMMAND cppcheck --enable=warning,performance,unusedFunction --project=${CMAKE_CURRENT_BINARY_DIR}/../compile_commands.json 2> ${CMAKE_CURRENT_BINARY_DIR}/static_analysis_result.txt ) add_custom_target(static_analysis DEPENDS cppcheck_analysis) # # Performance tests # -add_executable(perf_dense_map perf_dense_map.cpp) +add_executable(perf_dense_map performance_tests/perf_dense_map.cpp) add_custom_command(OUTPUT run_perf_tests COMMAND ./perf_dense_map DEPENDS perf_dense_map diff --git a/tests/build_cppcheck.sh b/tests/build_cppcheck.sh deleted file mode 100755 index 94f60bee..00000000 --- a/tests/build_cppcheck.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -if hash nproc; then - CPU_COUNT=$(nproc) -elif hash gnproc; then - CPU_COUNT=$(gnproc) -else - CPU_COUNT=1 -fi - -if [ ! -d cppcheck ]; then - git clone https://github.com/danmar/cppcheck/ cppcheck -fi - -cd cppcheck || exit -if [ ! -f cppcheck ]; then - git checkout 1.81 - make -j${CPU_COUNT} SRCDIR=build CFGDIR=cfg HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" -fi diff --git a/tests/integrationTests.json b/tests/integration_tests/integrationTests.json similarity index 95% rename from tests/integrationTests.json rename to tests/integration_tests/integrationTests.json index a20aa3e8..7bd49d5e 100644 --- a/tests/integrationTests.json +++ b/tests/integration_tests/integrationTests.json @@ -30,7 +30,7 @@ }, "image" : { "benchmark" : 0, - "file" : [ "../data/color_map.png" ], + "file" : [ "../../data/share/splash/color_map.png" ], "flip" : [ 0 ], "flop" : [ 0 ], "srgb" : [ 1 ], @@ -48,7 +48,7 @@ }, "mesh" : { "benchmark" : 0, - "file" : [ "../data/cubes.obj" ], + "file" : [ "../../data/share/splash/cubes.obj" ], "type" : "mesh" }, "object" : { diff --git a/tests/integrationTests_project.json b/tests/integration_tests/integrationTests_project.json similarity index 69% rename from tests/integrationTests_project.json rename to tests/integration_tests/integrationTests_project.json index 0b8a95d9..a8eb08bb 100644 --- a/tests/integrationTests_project.json +++ b/tests/integration_tests/integrationTests_project.json @@ -1,39 +1,47 @@ { "description" : "splashProject", "links" : [ - [ "mesh", "object" ], - [ "image", "object" ], - [ "object_image_filter", "object" ], - [ "object", "__camera_link" ], [ "object", "gui" ], + [ "object", "__camera_link" ], + [ "mesh", "object" ], + [ "object_image_filter", "object" ], + [ "image", "object" ], [ "image", "object_image_filter" ] ], "objects" : { "image" : { "alias" : [ "image" ], - "file" : [ "../data/color_map.png" ], + "file" : [ "../../data/share/splash/color_map.png" ], "flip" : [ 0 ], "flop" : [ 0 ], + "mediaInfo" : [ 4096, 4096, 32, 4, "RGBA", 1 ], "pattern" : [ 0 ], "priorityShift" : [ 0 ], + "savable" : [ 1 ], "srgb" : [ 1 ], + "timestamp" : [ 2124454423 ], "type" : "image" }, "mesh" : { "alias" : [ "mesh" ], - "file" : [ "../data/cubes.obj" ], + "file" : [ "../../data/share/splash/cubes.obj" ], "priorityShift" : [ 0 ], + "savable" : [ 1 ], + "timestamp" : [ 2124454684 ], "type" : "mesh" }, "object" : { "alias" : [ "object" ], + "color" : [ 0, 0, 0, 1 ], "fill" : [ "texture" ], "normalExponent" : [ 0 ], "position" : [ 0, 0, 0 ], "priorityShift" : [ 0 ], "rotation" : [ 0, 0, 0 ], + "savable" : [ 1 ], "scale" : [ 1, 1, 1 ], "sideness" : [ 0 ], + "timestamp" : [ 2124454423 ], "type" : "object" }, "object_image_filter" : { @@ -41,29 +49,25 @@ "blackLevel" : [ 0 ], "blackLevelAuto" : [ 0, 1 ], "brightness" : [ 1 ], + "buffer" : [ 0 ], "colorCurveAnchors" : [ 0 ], "colorTemperature" : [ 6500 ], "contrast" : [ 1 ], "fileFilterSource" : [ "" ], "filterSource" : [ "" ], + "grabMipmapLevel" : [ -1 ], "invertChannels" : [ 0 ], "keepRatio" : [ 0 ], "priorityShift" : [ 0 ], "saturation" : [ 1 ], + "savable" : [ 1 ], + "scale" : [ 1, 1 ], "size" : [ 4096, 4096 ], "sizeOverride" : [ -1, -1 ], - "type" : "filter" - }, - "probe" : { - "alias" : [ "probe" ], - "position" : [ 0, 0, 0 ], - "priorityShift" : [ 0 ], - "projection" : [ "equirectangular" ], - "rotation" : [ 0, 90, 0 ], - "size" : [ 2048, 2048 ], - "sphericalFov" : [ 180 ], - "type" : "virtual_probe" + "timestamp" : [ 2124454423 ], + "type" : "filter", + "watchShaderFile" : [ 0 ] } }, - "version" : "0.7.17" + "version" : "0.8.3" } diff --git a/tests/integration_tests.py b/tests/integration_tests/integration_tests.py similarity index 95% rename from tests/integration_tests.py rename to tests/integration_tests/integration_tests.py index 87b8bd20..5ce66fce 100644 --- a/tests/integration_tests.py +++ b/tests/integration_tests/integration_tests.py @@ -37,7 +37,7 @@ def runTests(): input() filepath = path + "/" + name - src = imp.load_source("data", path, open(filepath)) + src = imp.load_source("data", filepath, open(filepath)) if 'run' not in dir(src): print("File " + name + " has no run() method") diff --git a/tests/pytests/image_v4l2.py b/tests/integration_tests/pytests/image_v4l2.py similarity index 100% rename from tests/pytests/image_v4l2.py rename to tests/integration_tests/pytests/image_v4l2.py diff --git a/tests/pytests/object_linking.py b/tests/integration_tests/pytests/object_linking.py similarity index 100% rename from tests/pytests/object_linking.py rename to tests/integration_tests/pytests/object_linking.py diff --git a/tests/pytests/project.py b/tests/integration_tests/pytests/project.py similarity index 100% rename from tests/pytests/project.py rename to tests/integration_tests/pytests/project.py diff --git a/tests/pytests/replace_image.py b/tests/integration_tests/pytests/replace_image.py similarity index 95% rename from tests/pytests/replace_image.py rename to tests/integration_tests/pytests/replace_image.py index 0456753d..f8a7ef88 100644 --- a/tests/pytests/replace_image.py +++ b/tests/integration_tests/pytests/replace_image.py @@ -6,7 +6,7 @@ description = "Replace the Image object multiple times" def run(): for i in range(5): - filename = os.path.dirname(os.path.abspath(__file__)) + "/../data/color_map.png" + filename = os.path.dirname(os.path.abspath(__file__)) + "../../data/color_map.png" splash.set_world_attribute("replaceObject", ["image", "image", "image", "object"]) splash.set_object_attribute("image", "file", filename) sleep(1.0) diff --git a/tests/pytests/sample.py b/tests/integration_tests/pytests/sample.py similarity index 100% rename from tests/pytests/sample.py rename to tests/integration_tests/pytests/sample.py diff --git a/tests/pytests/video_codecs.py b/tests/integration_tests/pytests/video_codecs.py similarity index 51% rename from tests/pytests/video_codecs.py rename to tests/integration_tests/pytests/video_codecs.py index 2ef37830..59868303 100644 --- a/tests/pytests/video_codecs.py +++ b/tests/integration_tests/pytests/video_codecs.py @@ -5,12 +5,12 @@ description = "Test various supported video codecs" def run(): splash.set_world_attribute("replaceObject", ["image", "image_ffmpeg", "image", "object"]) - splash.set_object_attribute("image", "file", "./assets/tornado_h264.mov") + splash.set_object_attribute("image", "file", "../assets/tornado_h264.mov") sleep(10.0) - splash.set_object_attribute("image", "file", "./assets/tornado_hap.mov") + splash.set_object_attribute("image", "file", "../assets/tornado_hap.mov") sleep(10.0) - splash.set_object_attribute("image", "file", "./assets/tornado_hap_alpha.mov") + splash.set_object_attribute("image", "file", "../assets/tornado_hap_alpha.mov") sleep(10.0) - splash.set_object_attribute("image", "file", "./assets/tornado_hap_q.mov") + splash.set_object_attribute("image", "file", "../assets/tornado_hap_q.mov") sleep(10.0) splash.set_world_attribute("replaceObject", ["image", "image", "image", "object"]) diff --git a/tests/pytests/virtual_probe.py b/tests/integration_tests/pytests/virtual_probe.py similarity index 100% rename from tests/pytests/virtual_probe.py rename to tests/integration_tests/pytests/virtual_probe.py diff --git a/tests/pytests/wrapped_sink.py b/tests/integration_tests/pytests/wrapped_sink.py similarity index 100% rename from tests/pytests/wrapped_sink.py rename to tests/integration_tests/pytests/wrapped_sink.py diff --git a/tests/perf_dense_map.cpp b/tests/performance_tests/perf_dense_map.cpp similarity index 100% rename from tests/perf_dense_map.cpp rename to tests/performance_tests/perf_dense_map.cpp diff --git a/tests/check_attributefunctor.cpp b/tests/unit_tests/core/attribute.cpp similarity index 100% rename from tests/check_attributefunctor.cpp rename to tests/unit_tests/core/attribute.cpp diff --git a/tests/check_base_object.cpp b/tests/unit_tests/core/base_object.cpp similarity index 100% rename from tests/check_base_object.cpp rename to tests/unit_tests/core/base_object.cpp diff --git a/tests/check_serialization.cpp b/tests/unit_tests/core/serializer.cpp similarity index 100% rename from tests/check_serialization.cpp rename to tests/unit_tests/core/serializer.cpp diff --git a/tests/check_tree.cpp b/tests/unit_tests/core/tree.cpp similarity index 100% rename from tests/check_tree.cpp rename to tests/unit_tests/core/tree.cpp diff --git a/tests/check_value.cpp b/tests/unit_tests/core/value.cpp similarity index 100% rename from tests/check_value.cpp rename to tests/unit_tests/core/value.cpp diff --git a/tests/unitTests.cpp b/tests/unit_tests/unitTests.cpp similarity index 100% rename from tests/unitTests.cpp rename to tests/unit_tests/unitTests.cpp diff --git a/tests/check_dense_deque.cpp b/tests/unit_tests/utils/dense_deque.cpp similarity index 100% rename from tests/check_dense_deque.cpp rename to tests/unit_tests/utils/dense_deque.cpp diff --git a/tests/check_dense_map.cpp b/tests/unit_tests/utils/dense_map.cpp similarity index 100% rename from tests/check_dense_map.cpp rename to tests/unit_tests/utils/dense_map.cpp diff --git a/tests/check_dense_set.cpp b/tests/unit_tests/utils/dense_set.cpp similarity index 100% rename from tests/check_dense_set.cpp rename to tests/unit_tests/utils/dense_set.cpp diff --git a/tests/check_upgrade_configuration.cpp b/tests/unit_tests/utils/jsonutils.cpp similarity index 100% rename from tests/check_upgrade_configuration.cpp rename to tests/unit_tests/utils/jsonutils.cpp diff --git a/tests/check_resizablearray.cpp b/tests/unit_tests/utils/resizable_array.cpp similarity index 100% rename from tests/check_resizablearray.cpp rename to tests/unit_tests/utils/resizable_array.cpp