Native code testing
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
cb9dc3170d
commit
b0aecef1ed
@ -1,26 +1,57 @@
|
|||||||
cmake_minimum_required(VERSION 3.10.0)
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
project(StormEngine VERSION 0.1.0 LANGUAGES C)
|
project(StormEngine VERSION 0.1.0 LANGUAGES C)
|
||||||
|
|
||||||
# Find sources
|
# Find sources
|
||||||
file(GLOB_RECURSE SOURCES src/fluid/src/**.c)
|
file(GLOB_RECURSE SOURCES src/fluid/src/**.c)
|
||||||
|
|
||||||
#include header files
|
# include header files
|
||||||
include_directories(src/fluid/includes)
|
include_directories(src/fluid/includes)
|
||||||
|
|
||||||
#include jni
|
# include jni
|
||||||
find_package(JNI REQUIRED)
|
find_package(JNI REQUIRED)
|
||||||
include_directories(${JNI_INCLUDE_DIRS})
|
include_directories(${JNI_INCLUDE_DIRS})
|
||||||
|
|
||||||
#include architecture flags
|
# Create shared library
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mavx -mavx2")
|
|
||||||
|
|
||||||
#emit to shared-folder
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/shared-folder)
|
|
||||||
|
|
||||||
#Create shared library
|
|
||||||
add_library(StormEngine SHARED ${SOURCES})
|
add_library(StormEngine SHARED ${SOURCES})
|
||||||
|
|
||||||
|
# set props for the lib
|
||||||
|
target_compile_options(StormEngine PRIVATE -m64 -mavx -mavx2)
|
||||||
|
set_target_properties(StormEngine PROPERTIES
|
||||||
|
CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/shared-folder
|
||||||
|
)
|
||||||
|
|
||||||
|
# include and enable testing
|
||||||
include(CTest)
|
include(CTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
# emit test driver to outdir
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/out/build/default)
|
||||||
|
|
||||||
|
# Grab test files
|
||||||
|
file(GLOB_RECURSE TEST_FILES ${CMAKE_SOURCE_DIR}/test/c/**.c)
|
||||||
|
set(TEST_DRIVER test_driver.c)
|
||||||
|
|
||||||
|
# preprocess the test files to use relative paths
|
||||||
|
set(TEST_SOURCES "")
|
||||||
|
foreach(TEST_FILE ${TEST_FILES})
|
||||||
|
file(RELATIVE_PATH REL_TEST_FILE ${CMAKE_SOURCE_DIR} ${TEST_FILE})
|
||||||
|
# get_filename_component (TEST_NAME ${TEST_FILE} NAME)
|
||||||
|
list(APPEND TEST_SOURCES ${REL_TEST_FILE})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Add test sources
|
||||||
|
create_test_sourcelist(TEST_SOURCE_LIST ${TEST_DRIVER} ${TEST_SOURCES})
|
||||||
|
|
||||||
|
# Create test executable
|
||||||
|
add_executable(test_runner ${TEST_SOURCE_LIST})
|
||||||
|
|
||||||
|
# link the library to the test executable
|
||||||
|
target_link_libraries(test_runner StormEngine)
|
||||||
|
|
||||||
|
# add tests for each test source file
|
||||||
|
foreach (TEST_FILE ${TEST_SOURCES})
|
||||||
|
get_filename_component (TEST_NAME ${TEST_FILE} NAME_WE)
|
||||||
|
get_filename_component (TEST_PATH ${TEST_FILE} DIRECTORY)
|
||||||
|
add_test(NAME ${TEST_NAME} COMMAND test_runner ${TEST_PATH}/${TEST_NAME})
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
|||||||
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@ -89,5 +89,19 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
catchError {
|
||||||
|
sh 'cd ./out/build/default && ctest && cd ../../..'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
junit testResults: 'target/surefire-reports/*.xml', keepLongStdio: true, testDataPublishers: [[$class:'AttachmentPublisher']]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1220,6 +1220,10 @@ Fluid simulation normalization ratio
|
|||||||
Stabilized static liquids
|
Stabilized static liquids
|
||||||
Integrate CMake + Ninja
|
Integrate CMake + Ninja
|
||||||
|
|
||||||
|
(12/02/2024)
|
||||||
|
Add testing to native code side
|
||||||
|
Add native testing step to jenkins pipeline
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
6
test/c/StormEngineTests.c
Normal file
6
test/c/StormEngineTests.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int test_c_StormEngineTests(int argc, char **argv){
|
||||||
|
printf("it lives\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
5
test/c/TestAsdf.c
Normal file
5
test/c/TestAsdf.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
|
int test_c_TestAsdf(){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user