Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run embedding API tests on Linux #96

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .yamato/scripts/test_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ echo

echo
echo "***********************************"
echo "Unity: Skipping embedding API tests"
echo "Unity: Running embedding API tests"
echo "***********************************"
echo
# cd unity/embed_api_tests
# cmake -DCMAKE_BUILD_TYPE=$configuration .
# cmake --build .
# ./mono_test_app
# cd ../../
cd unity/embed_api_tests
cmake -DCMAKE_BUILD_TYPE=$configuration .
cmake --build .
./mono_test_app
cd ../../

echo
echo "**********************************"
Expand Down
3 changes: 3 additions & 0 deletions unity/embed_api_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ include_directories(${CLR_DIR}/src/inc)

add_executable(${PROJECT_NAME_STR} ${PROJECT_SRC_FILES})
target_link_libraries(${PROJECT_NAME_STR} ${CMAKE_DL_LIBS})
if(UNIX AND NOT APPLE)
target_link_libraries(${PROJECT_NAME_STR} pthread)
endif()
target_compile_features(${PROJECT_NAME_STR} PRIVATE cxx_range_for)
target_compile_definitions(${PROJECT_NAME_STR} PRIVATE ENABLE_MONO=1 PLATFORM_STANDALONE=1)
14 changes: 10 additions & 4 deletions unity/embed_api_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#define UNITY_EDITOR 1
#define USE_CORECLR

// On macOS the compiler does not define _DEBUG, but CMake defines
// On macOS and Linux the compiler does not define _DEBUG, but CMake defines
// NDEBUG for release builds, so if NDEBUG is not defined, assume this
// is a debug build and define _DEBUG.
#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__linux__)
#ifndef NDEBUG
#define _DEBUG
#endif
Expand Down Expand Up @@ -89,6 +89,7 @@ void* get_handle()
if(s_MonoLibrary == nullptr)
{
assert(false && "Failed to load mono\n");
printf("Failed to load mono from '%s'\n", g_monoDllPath.c_str());
exit(1);
}
}
Expand Down Expand Up @@ -2439,8 +2440,13 @@ void SetupMono(Mode mode)
#endif // __aarch64__
#endif
#elif defined(__linux__)
monoLibFolder = "/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.0";
g_monoDllPath = "../../bin/Product/Linux.x64.Debug/libcoreclr.so";
#if defined(_DEBUG)
monoLibFolder = abs_path_from_file("../../artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Debug/runtimes/linux-x64/lib/net7.0");
g_monoDllPath = abs_path_from_file("../../artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Debug/runtimes/linux-x64/native/libcoreclr.so");
#else
monoLibFolder = abs_path_from_file("../../artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/lib/net7.0");
g_monoDllPath = abs_path_from_file("../../artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/native/libcoreclr.so");
#endif
#elif defined(WIN32)
#if defined(_DEBUG)
#ifdef _M_AMD64
Expand Down