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

Use gtest to execute tests with aarch64-x64-mingw changes #44

Merged
merged 3 commits into from
Nov 20, 2023
Merged

Conversation

eukarpov
Copy link
Member

No description provided.

Copy link
Member

@Blackhex Blackhex left a comment

Choose a reason for hiding this comment

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

I am not sure if your intention is to further extend the tests with proper EXPECT_* calls in the following PRs or they should be in this one.

@@ -0,0 +1,47 @@
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_COMPILER "$ENV{HOME}/cross/bin/aarch64-w64-mingw32-gcc")
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather change this to $ENV{INSTALL_PATH}/bin/${TARGET}-gcc to be more compatible with .github/scripts/build.sh. The default of INSTALL_PATH can be $ENV{HOME}/cross.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

tests/BUILD.txt Outdated
cmake --build build

it generates Arm64 Windows executable
build/aarch64_mingw_tests
Copy link
Member

Choose a reason for hiding this comment

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

It's quite confusing that the generated build folder contains bin folder but the actual produced binary is in the build folder and bin is empty.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

tests/BUILD.txt Outdated
cmake --build build

it generates Arm64 Windows executable
build/aarch64_mingw_tests
Copy link
Member

Choose a reason for hiding this comment

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

So far the repository is using - as word delimiter in file names. This adds inconsistency. The same applies for file names of all the tests in this folder and for git branch names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

tests/BUILD.txt Outdated
cmake -S . -B build
cmake --build build

it generates Arm64 Windows executable
Copy link
Member

Choose a reason for hiding this comment

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

Why not a full sentence? (Starting with capital letter and ending with ..)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

varargs_test.cpp
)

set_source_files_properties(test-dll.c PROPERTIES COMPILE_FLAGS "-DIMPORT_API=")
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain why this is required?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. It is not needed for now after excluding dll-test from testing.

Copy link
Member Author

Choose a reason for hiding this comment

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

It has been removed


TEST(Aarch64MinGW, BigDataTest)
{
printf("main\n");
Copy link
Member

Choose a reason for hiding this comment

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

Those printfs are useless for the gtest tests. On the other hand, I'd expect a series of EXPECT_* calls at the end of this function (fixture method). I am affraid that without them, the tests would pass even if there would be an error.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. As it was mentioned in another comment it will be done in second iteration.

Copy link
Member

Choose a reason for hiding this comment

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

Test files naming is inconsistent with naming of examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

because examples and tests have different purpose and most probably they will be contain different sets later, maybe it is fine to have different naming?

Copy link
Member

Choose a reason for hiding this comment

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

Different naming is IMO OK, I am asking for keeping it consistent with the overall repository codestyle.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

enable_testing()

add_executable(
aarch64_mingw_tests
Copy link
Member

Choose a reason for hiding this comment

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

This creates executable without the .exe extension. It needs to be renamed manually to execute it.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I was thinking about it and I was not sure what will be right extension for executable. it will be changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


if (SymGetSymFromAddr64(hp, offset, &dwDisplacement, p))
{
printf(" %s+0x%.04llX", p->Name, dwDisplacement);
Copy link
Member

Choose a reason for hiding this comment

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

This test is heavily versbose, we should disable printing the standard output, at least for this test.

Copy link
Member Author

Choose a reason for hiding this comment

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

It has been commented.

@eukarpov
Copy link
Member Author

I am not sure if your intention is to further extend the tests with proper EXPECT_* calls in the following PRs or they should be in this one.

Totally agree. On the first step tests integration with gtest it will be good to know that tests are executed fully without crash on Arm64. Definitely tests should be refactored and extended by extra checks. As it was discussed it will be second iteration based on gnu packages testing.

Building aarch64-w64-mingw32 tests on Linux or WSL

cmake -S . -B build
cmake --build build
Copy link
Member

Choose a reason for hiding this comment

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

It would be handy to add the build folder to .gitignore.

Copy link
Member

@Blackhex Blackhex left a comment

Choose a reason for hiding this comment

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

All my comments addressed, approving.

@eukarpov eukarpov mentioned this pull request Nov 20, 2023
Closed
@eukarpov eukarpov merged commit 11c3827 into main Nov 20, 2023
4 checks passed
@eukarpov eukarpov deleted the add_gtest branch November 20, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants