forked from RedisAI/redis-inference-optimization
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests boilerplate (RedisAI#446)
* [wip] wip on unit tests boilerplate * [fix] Fixes per PR review: identation * [fix] Fixes per PR review: rename test folder to tests * [fix] Fixes per PR review: renaming /test/ to /tests/ across project related files * [fix] Fixes per PR review: renamed python3 command helper on tests * [add] increased CI coverage test timeout limit to 30min ( was 20m ) * [fix] Fixes per PR review: rename test/ to tests/ on dockerfiles and readme * [wip] wip on normalization * [wip] Fixed autobatching on tests on torch and tensorflow * [fix] Fixes per PR review: Control unit tests via unit/tests.sh * [fix] Fixed CI dockerbuild * [fix] Fixed Dockerfile.gpu-test * [fix] Reverted swap on minbatchsize on batching tests (probably a forgotten merge conflict on my side) * [fix] Fixes per PR review: removed tests/unit/unit_tests_tensor.cpp. Added common alloc test overloading to rmalloc.h * [fix] Fixes per PR review. Added setup step for unit tests
- Loading branch information
1 parent
f3e5729
commit a5863db
Showing
75 changed files
with
231 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
/deps/ | ||
/build/ | ||
/install* | ||
/test/venv/ | ||
/tests/venv/ | ||
logs/ | ||
/test/logs/ | ||
/tests/logs/ | ||
.env/ | ||
env*/ | ||
.venv/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "opt/readies"] | ||
path = opt/readies | ||
url = https://github.com/RedisLabsModules/readies.git | ||
[submodule "opt/googletest"] | ||
path = opt/googletest | ||
url = https://github.com/google/googletest.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule googletest
added at
adeef1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
add_subdirectory("${PROJECT_SOURCE_DIR}/opt/googletest" "opt/googletest") | ||
|
||
mark_as_advanced( | ||
BUILD_GMOCK BUILD_GTEST BUILD_SHARED_LIBS | ||
gmock_build_tests gtest_build_samples gtest_build_tests | ||
gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols | ||
) | ||
|
||
|
||
macro(package_add_test TESTNAME) | ||
# create an exectuable in which the tests will be stored | ||
add_executable(${TESTNAME} ${ARGN}) | ||
|
||
target_include_directories(${TESTNAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>) | ||
|
||
# link the Google tests infrastructure, mocking library, and a default main fuction to | ||
# the tests executable. Remove g_test_main if writing your own main function. | ||
target_link_libraries(${TESTNAME} gtest gmock gtest_main redisai redisai_torch redisai_tensorflow) | ||
|
||
# gtest_discover_tests replaces gtest_add_tests, | ||
# see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it | ||
gtest_discover_tests(${TESTNAME} | ||
# set a working directory so your project root so that you can find tests data via paths relative to the project root | ||
WORKING_DIRECTORY ${PROJECT_DIR} | ||
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_DIR}" | ||
) | ||
set_target_properties(${TESTNAME} PROPERTIES FOLDER tests) | ||
endmacro() | ||
|
||
package_add_test(unit_tests_err unit_tests_err.cpp) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
#ifndef TEST_UNIT_RMALLOC_H_ | ||
#define TEST_UNIT_RMALLOC_H_ | ||
|
||
#include "../../src/redismodule.h" | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
void Alloc_Reset() { | ||
RedisModule_Alloc = malloc; | ||
RedisModule_Realloc = realloc; | ||
RedisModule_Calloc = calloc; | ||
RedisModule_Free = free; | ||
RedisModule_Strdup = strdup; | ||
} | ||
|
||
#endif /* TEST_UNIT_RMALLOC_H_ */ |
Oops, something went wrong.