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

Google tests framework for UnitTests #1277

Merged
merged 59 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
fe3cedb
Google tests framework for UnitTesting
CedricGuillemet Aug 7, 2023
81ce56a
includes, android tests
CedricGuillemet Aug 7, 2023
7de3ebd
test exit code
CedricGuillemet Aug 7, 2023
d84daee
npm android
CedricGuillemet Aug 7, 2023
4232bfa
bgfx noop
CedricGuillemet Aug 7, 2023
f21cba0
console callback, missing .js for android
CedricGuillemet Aug 7, 2023
df3cea0
removed comment
CedricGuillemet Aug 7, 2023
6e3fa54
android logging
CedricGuillemet Aug 7, 2023
486157e
close stdout
CedricGuillemet Aug 7, 2023
3a77d0c
flush stdout
CedricGuillemet Aug 7, 2023
d77202c
close pipes
CedricGuillemet Aug 7, 2023
95d2796
yet another log attachment
CedricGuillemet Aug 7, 2023
0524d5a
logger...
CedricGuillemet Aug 7, 2023
4b391b1
no stop
CedricGuillemet Aug 7, 2023
ad3f645
no thread
CedricGuillemet Aug 7, 2023
ad98680
pfd
CedricGuillemet Aug 7, 2023
58d3998
pfd
CedricGuillemet Aug 7, 2023
b173c0c
vbuf
CedricGuillemet Aug 7, 2023
cc619b9
vbuf
CedricGuillemet Aug 7, 2023
448f03d
descriptors
CedricGuillemet Aug 7, 2023
f1b5fd8
log
CedricGuillemet Aug 8, 2023
5deff08
timeout
CedricGuillemet Aug 8, 2023
7ff626d
nop
CedricGuillemet Aug 8, 2023
2582c4c
disable android tests for now
CedricGuillemet Aug 8, 2023
c75c6bb
life cycle test
CedricGuillemet Aug 8, 2023
914361e
inspector test
CedricGuillemet Aug 8, 2023
44d9e31
disable android tests
CedricGuillemet Aug 8, 2023
e7bd7a1
JS test
CedricGuillemet Aug 8, 2023
16cd56d
disable lifecycle test
CedricGuillemet Aug 8, 2023
419c0cd
fix capture
CedricGuillemet Aug 8, 2023
ebac593
disable js scripts
CedricGuillemet Aug 8, 2023
7899764
revert
CedricGuillemet Aug 8, 2023
2f8c471
revert jobs
CedricGuillemet Aug 8, 2023
3b1c556
nop
CedricGuillemet Aug 8, 2023
c6ca460
Update Apps/UnitTests/Android/app/src/main/res/values/strings.xml
CedricGuillemet Sep 5, 2023
c1fc566
Update Apps/UnitTests/Shared/Tests.h
CedricGuillemet Sep 5, 2023
bd28c7c
PR feedback and testing with v8inspector crash fix
CedricGuillemet Sep 5, 2023
b4e0895
Merge branch 'master' of https://github.com/BabylonJS/BabylonNative i…
CedricGuillemet Sep 5, 2023
f0f452c
up jsr
CedricGuillemet Sep 5, 2023
3a256df
absolute path
CedricGuillemet Sep 5, 2023
271921a
hash
CedricGuillemet Sep 5, 2023
4f274ad
up jsr
CedricGuillemet Sep 5, 2023
51051c1
hash
CedricGuillemet Sep 5, 2023
23ad135
Update Apps/UnitTests/Android/app/src/main/cpp/CMakeLists.txt
CedricGuillemet Sep 6, 2023
8f8a40f
disable CPP LifeCycle tests for now
CedricGuillemet Sep 19, 2023
4e75cff
Merge branch 'master' of https://github.com/babylonJS/BabylonNative i…
CedricGuillemet Sep 19, 2023
8a9e804
JSR host
CedricGuillemet Sep 19, 2023
af277d9
bgfx render type
CedricGuillemet Sep 19, 2023
9abf136
render type
CedricGuillemet Sep 19, 2023
d295d55
Disable Android Tests
CedricGuillemet Sep 19, 2023
6a3a64b
Update Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
CedricGuillemet Sep 20, 2023
57bc2a2
Update Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
CedricGuillemet Sep 20, 2023
db9eaba
Update Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
CedricGuillemet Sep 20, 2023
31d9c10
Update Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
CedricGuillemet Sep 20, 2023
f565e61
Update Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
CedricGuillemet Sep 20, 2023
6595193
Update Core/Graphics/Source/DeviceImpl.h
CedricGuillemet Sep 20, 2023
99aef2e
gtest_force_shared_crt infos
CedricGuillemet Sep 20, 2023
8538d9c
win32 check for gtest
CedricGuillemet Sep 20, 2023
4546452
better win32 check
CedricGuillemet Sep 20, 2023
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
16 changes: 10 additions & 6 deletions Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
#include <atomic>
#include <Shared/Tests.h>

static int pfd[2];
static int fd_saved[2];
void *thread_func(void*)
namespace
{
int pfd[2];
int fd_saved[2];
}
void* thread_func(void*)
{
ssize_t rdsz;
char buf[128];
while((rdsz = read(pfd[0], buf, sizeof buf - 1)) > 0) {
if(buf[rdsz - 1] == '\n') --rdsz;
while ((rdsz = read(pfd[0], buf, sizeof buf - 1)) > 0)
{
if (buf[rdsz - 1] == '\n') --rdsz;
buf[rdsz] = 0;
__android_log_write(ANDROID_LOG_DEBUG, "UnitTests", buf);
}
Expand All @@ -35,7 +39,7 @@ void start_logger()
dup2(pfd[1], 2);

// spawn the logging thread
if(pthread_create(&thr, 0, thread_func, 0) == -1)
if (pthread_create(&thr, 0, thread_func, 0) == -1)
{
return;
}
Expand Down
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ endif()


if(NOT WINDOWS_STORE)
CedricGuillemet marked this conversation as resolved.
Show resolved Hide resolved
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt OFF CACHE BOOL "" FORCE)
if(WIN32)
# For Windows: Prevent overriding the parent project's compiler/linker settings
# Default build type for my test projects are /MDd (MultiThreaded DLL) but GTests default to /MTd (MultiTreaded)
# see https://github.com/google/googletest/blob/main/googletest/README.md
# "Enabling this option will make gtest link the runtimes dynamically too, and match the project in which it is included."
set(gtest_force_shared_crt OFF CACHE BOOL "" FORCE)
endif()
Comment on lines +69 to +75
Copy link
Contributor

@bghgary bghgary Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There are tabs here instead of spaces. Also spelling errors "MultiTreaded"

set(CONTENT_TO_FETCH ${CONTENT_TO_FETCH} googletest)
endif()

Expand Down
2 changes: 1 addition & 1 deletion Core/Graphics/Source/DeviceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace Babylon::Graphics

static const bool s_bgfxFlipAfterRender;
static const bgfx::RendererType::Enum s_bgfxRenderType;
static void ConfigureBgfxPlatformData(bgfx::PlatformData& platformData, WindowT window);
static void ConfigureBgfxPlatformData(bgfx::PlatformData& pd, WindowT window);
static void ConfigureBgfxRenderType(bgfx::PlatformData& pd, bgfx::RendererType::Enum& renderType);
static float GetDevicePixelRatio(WindowT window);

Expand Down