In order to avoid build failures on MS, we use -fms-compatibility too in the
tests.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 18735 Build 18735: arc lint + arc unit
Event Timeline
This patch does not target testImport because I am not sure how to handle the options there:
auto RunOptsFrom = getRunOptionsForLanguage(FromLang); auto RunOptsTo = getRunOptionsForLanguage(ToLang); for (const auto &FromArgs : RunOptsFrom) for (const auto &ToArgs : RunOptsTo) EXPECT_TRUE(testImport(FromCode, FromArgs, ToCode, ToArgs, Verifier, AMatcher));
I think, it is overkill to test all possible combinations of the options, we should come up with something better here.
Perhaps we could exploit parameterized tests here as well. @a.sidorin, @xazax.hun What is your opinion?
I think, it is overkill to test all possible combinations of the options, we should come up with something better here.
I agree with that. I think we need to test just import pairs {/*From*/no_option, /*To*/no_option}, {option_1, option1}, {option_2, option_2}, ...{option_n, option_n}.
Another option is to just turn -fno-delayed-template-parsing -fno-ms-compatibility for ASTImporter tests like it is done in some unit tests, but I'm not sure it's a correct solution.
I agree with that. I think we need to test just import pairs {/*From*/no_option, /*To*/no_option}, {option_1, option1}, {option_2, option_2}, ...{option_n, option_n}.
This patch does exactly that with the parameterized tests. Each elements of the DefaultTestValuesForRunOptions will be used both for the "To" and for the "From" context.
So we will have each TEST_P generating 4 cases:
[FROM, TO]
{no_option, no_option}
{"-fdelayed-template-parsing", "-fdelayed-template-parsing"}
{"-fms-compatibility", "-fms-compatibility"}
{"-fdelayed-template-parsing -fms-compatibility", "-fdelayed-template-parsing -fms-compatibility"}
- Moved the family of testImport functions under a test fixture class, so we can use parameterized test.
- Refactored testImport and testImportSequence, because for loops over the different compiler options is no longer needed, that is handeld by the test framework via parameters from now on.
Balazs, could you please review this patch as well? (This code is not in our fork yet.)
Found no big problems. But not all extra options are applicable to all languages (template related things to C) so there may be redundant tests.
LGTM, thank you!
Could you describe the refactoring in the commit message?
unittests/AST/ASTImporterTest.cpp | ||
---|---|---|
212 | Looks like clang-format broke this comment in some places. |
Looks like clang-format broke this comment in some places.