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

Windows test fixes #196

Merged
merged 4 commits into from
Feb 5, 2024
Merged

Conversation

fsfod
Copy link
Contributor

@fsfod fsfod commented Feb 4, 2024

Not all tests pass yet, but they shouldn't crash early with a fatal assert from Clang any more. The library tests could fail in assert builds before because an Error value for a from a Coff symbol in Dyld::BuildBloomFilter was not handled, those errors were actually revealing another issue that search path to load shared libraries to find symbols should be much more restricted instead of PATH environment variable.
I also added the exporting of some MSVC runtime symbols based on the code from Clings cmake files to try and fix STL symbol errors, but tests still fail because of missing emulated TLS symbols __emutls_get_address and __emutls_v._Init_thread_epoch .

Current failing tests are:

 EnumReflectionTest.GetIntegerTypeFromEnumScope
 EnumReflectionTest.GetIntegerTypeFromEnumType
 FunctionReflectionTest.GetFunctionAddress
 FunctionReflectionTest.Construct
 FunctionReflectionTest.Destruct

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (5953058) 78.83% compared to head (7bdf6ea) 78.63%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #196      +/-   ##
==========================================
- Coverage   78.83%   78.63%   -0.21%     
==========================================
  Files           8        8              
  Lines        3048     3056       +8     
==========================================
  Hits         2403     2403              
- Misses        645      653       +8     
Files Coverage Δ
lib/Interpreter/CppInterOp.cpp 86.31% <ø> (ø)
lib/Interpreter/DynamicLibraryManagerSymbol.cpp 68.47% <0.00%> (-0.92%) ⬇️
Files Coverage Δ
lib/Interpreter/CppInterOp.cpp 86.31% <ø> (ø)
lib/Interpreter/DynamicLibraryManagerSymbol.cpp 68.47% <0.00%> (-0.92%) ⬇️

Copy link
Contributor

github-actions bot commented Feb 4, 2024

clang-tidy review says "All clean, LGTM! 👍"

@@ -2463,6 +2463,10 @@ namespace Cpp {
std::vector<const char *> ClingArgv = {"-resource-dir", ResourceDir.c_str(),
"-std=c++14"};
ClingArgv.insert(ClingArgv.begin(), MainExecutableName.c_str());
#ifdef _WIN32
// FIXME : Workaround Sema::PushDeclContext assert on windows
ClingArgv.push_back("-fno-delayed-template-parsing");
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried -fno-emulated-tls there and still got the same emulated TLS symbol errors. It looks like its defaulted to on from JITTargetMachineBuilder's constructor.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we need a patch in upstream clang?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I don't really know how it should work for windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, understood. Let's move forward with this PR and fix the remaining tests later.

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM! @mcbarton, after this PR we might be able to remove from the CI the make-it-all-green for windows and disable only the failing tests.

@vgvassilev
Copy link
Contributor

@fsfod, forgot to say - can you apply clang-format on per-commit basis or shall I?

Copy link
Contributor

github-actions bot commented Feb 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

@mcbarton
Copy link
Collaborator

mcbarton commented Feb 5, 2024

LGTM! @mcbarton, after this PR we might be able to remove from the CI the make-it-all-green for windows and disable only the failing tests.

@vgvassilev This would not be possible if it was merged right now, as when CppInterOp uses Cling on Windows it currently aborts in the following tests in the CI

  • InterpreterTest.Process
  • DynamicLibraryManagerTest.Sanity

cc: @fsfod Any idea what is causing these tests to fail (and subsequently abort the test runs) in the Cling version , but not the Clang-Repl version?

@fsfod
Copy link
Contributor Author

fsfod commented Feb 5, 2024

There are two tests that fail that are not export related:

[ RUN      ] EnumReflectionTest.GetIntegerTypeFromEnumScope
EnumReflectionTest.cpp(127): error: Expected equality of these values:
  Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[4]))
    Which is: "int"
  "unsigned int"
[ RUN      ] EnumReflectionTest.GetIntegerTypeFromEnumType
EnumReflectionTest.cpp(183): error: Expected equality of these values:
  get_int_type_from_enum_var(Decls[10])
    Which is: "int"
  "unsigned int"

MSVC defaults to int as the base type for enums ;

@vgvassilev
Copy link
Contributor

There are two tests that fail that are not export related:

[ RUN      ] EnumReflectionTest.GetIntegerTypeFromEnumScope
EnumReflectionTest.cpp(127): error: Expected equality of these values:
  Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[4]))
    Which is: "int"
  "unsigned int"
[ RUN      ] EnumReflectionTest.GetIntegerTypeFromEnumType
EnumReflectionTest.cpp(183): error: Expected equality of these values:
  get_int_type_from_enum_var(Decls[10])
    Which is: "int"
  "unsigned int"

MSVC defaults to int as the base type for enums ;

Ok, so the tests need to be adjusted for windows...

Copy link
Contributor

github-actions bot commented Feb 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

@fsfod
Copy link
Contributor Author

fsfod commented Feb 5, 2024

Any idea what is causing these tests to fail (and subsequently abort the test runs) in the Cling version , but not the Clang-Repl version?

Maybe memory was double free'ed in cling::Value or it was uninitialized data being free'ed?

@vgvassilev
Copy link
Contributor

Let’s move forward here and address the remaining issues in a subsequent PR.

@vgvassilev vgvassilev merged commit eb2f4ef into compiler-research:main Feb 5, 2024
32 of 34 checks passed
@fsfod fsfod deleted the win_testfixes branch February 7, 2024 01:34
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.

3 participants