-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Test P1502R1 Standard Library Header Units #1388
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
Merged
StephanTLavavej
merged 4 commits into
microsoft:master
from
StephanTLavavej:header_units
Oct 23, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
443ae9c
Add P1502R1_standard_library_header_units.
StephanTLavavej b005745
v2: Fix failures, code review feedback.
StephanTLavavej 7161ca0
v3: Enable more tests for MSVC-internal builds.
StephanTLavavej 4815085
v4: std::variant compiler assertion has been fixed.
StephanTLavavej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/std/tests/P1502R1_standard_library_header_units/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
126 changes: 126 additions & 0 deletions
126
tests/std/tests/P1502R1_standard_library_header_units/custom_format.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from stl.test.format import STLTestFormat, TestStep | ||
|
|
||
|
|
||
| class CustomTestFormat(STLTestFormat): | ||
| def getBuildSteps(self, test, lit_config, shared): | ||
| shared.exec_dir = test.getExecDir() | ||
| output_base = test.getOutputBaseName() | ||
| output_dir = test.getOutputDir() | ||
| source_path = Path(test.getSourcePath()) | ||
|
|
||
| stl_headers = [ | ||
| 'algorithm', | ||
StephanTLavavej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'any', | ||
| 'array', | ||
| 'atomic', | ||
| 'barrier', | ||
| 'bit', | ||
| 'bitset', | ||
| 'charconv', | ||
| 'chrono', | ||
| 'codecvt', | ||
| 'compare', | ||
| 'complex', | ||
| 'concepts', | ||
| 'condition_variable', | ||
| 'coroutine', | ||
| 'deque', | ||
| 'exception', | ||
| 'execution', | ||
| 'filesystem', | ||
| # 'format', | ||
| 'forward_list', | ||
| 'fstream', | ||
| 'functional', | ||
| 'future', | ||
| 'initializer_list', | ||
| 'iomanip', | ||
| 'ios', | ||
| 'iosfwd', | ||
| 'iostream', | ||
| 'istream', | ||
| 'iterator', | ||
| 'latch', | ||
| 'limits', | ||
| 'list', | ||
| 'locale', | ||
| 'map', | ||
| 'memory_resource', | ||
| 'memory', | ||
| 'mutex', | ||
| 'new', | ||
| 'numbers', | ||
| 'numeric', | ||
| 'optional', | ||
| 'ostream', | ||
| 'queue', | ||
| 'random', | ||
| 'ranges', | ||
| 'ratio', | ||
| 'regex', | ||
| 'scoped_allocator', | ||
| 'semaphore', | ||
| 'set', | ||
| 'shared_mutex', | ||
| # 'source_location', | ||
| 'span', | ||
| 'sstream', | ||
| 'stack', | ||
| 'stdexcept', | ||
| 'stop_token', | ||
| 'streambuf', | ||
| 'string_view', | ||
| 'string', | ||
| 'strstream', | ||
| # 'syncstream', | ||
| 'system_error', | ||
| 'thread', | ||
| 'tuple', | ||
| 'type_traits', | ||
| 'typeindex', | ||
| 'typeinfo', | ||
| 'unordered_map', | ||
| 'unordered_set', | ||
| 'utility', | ||
| 'valarray', | ||
| 'variant', | ||
| 'vector', | ||
| 'version', | ||
| ] | ||
|
|
||
| compile_test_cpp_with_edg = test.cxx.flags.count('/BE') == 1 | ||
|
|
||
| if compile_test_cpp_with_edg: | ||
| test.cxx.flags.remove('/BE') | ||
|
|
||
| header_unit_options = [] | ||
|
|
||
| for header in stl_headers: | ||
| header_obj_path = output_dir / (header + '.obj') | ||
|
|
||
| header_unit_options.append('/headerUnit') | ||
| header_unit_options.append('{0}/{1}={1}.ifc'.format(test.config.cxx_headers, header)) | ||
|
|
||
| if not compile_test_cpp_with_edg: | ||
| header_unit_options.append(str(header_obj_path)) | ||
|
|
||
| cmd, out_files = test.cxx._basicCmd(source_files = [], out = None, | ||
| flags = ['/exportHeader', '<{}>'.format(header), '/Fo{}'.format(str(header_obj_path))], | ||
| skip_mode_flags = True) | ||
| yield TestStep(cmd, shared.exec_dir, [], test.cxx.compile_env) | ||
|
|
||
| if compile_test_cpp_with_edg: | ||
| test.cxx.flags.append('/BE') | ||
|
|
||
| cmd, out_files, shared.exec_file = \ | ||
| test.cxx.executeBasedOnFlagsCmd([source_path], | ||
| output_dir, shared.exec_dir, | ||
| output_base, header_unit_options, [], []) | ||
|
|
||
| yield TestStep(cmd, shared.exec_dir, [source_path], | ||
| test.cxx.compile_env) | ||
105 changes: 105 additions & 0 deletions
105
tests/std/tests/P1502R1_standard_library_header_units/custombuild.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| use Run; | ||
|
|
||
| sub CustomBuildHook() | ||
| { | ||
| my $cwd = Run::GetCWDName(); | ||
| my $stl_include_dir = $ENV{STL_INCLUDE_DIR}; | ||
|
|
||
| my @stl_headers = ( | ||
| "algorithm", | ||
| "any", | ||
| "array", | ||
| "atomic", | ||
| "barrier", | ||
| "bit", | ||
| "bitset", | ||
| "charconv", | ||
| "chrono", | ||
| "codecvt", | ||
| "compare", | ||
| "complex", | ||
| "concepts", | ||
| "condition_variable", | ||
| "coroutine", | ||
| "deque", | ||
| "exception", | ||
| "execution", | ||
| "filesystem", | ||
| # "format", | ||
| "forward_list", | ||
| "fstream", | ||
| "functional", | ||
| "future", | ||
| "initializer_list", | ||
| "iomanip", | ||
| "ios", | ||
| "iosfwd", | ||
| "iostream", | ||
| "istream", | ||
| "iterator", | ||
| "latch", | ||
| "limits", | ||
| "list", | ||
| "locale", | ||
| "map", | ||
| "memory_resource", | ||
| "memory", | ||
| "mutex", | ||
| "new", | ||
| "numbers", | ||
| "numeric", | ||
| "optional", | ||
| "ostream", | ||
| "queue", | ||
| "random", | ||
| "ranges", | ||
| "ratio", | ||
| "regex", | ||
| "scoped_allocator", | ||
| "semaphore", | ||
| "set", | ||
| "shared_mutex", | ||
| # "source_location", | ||
| "span", | ||
| "sstream", | ||
| "stack", | ||
| "stdexcept", | ||
| "stop_token", | ||
| "streambuf", | ||
| "string_view", | ||
| "string", | ||
| "strstream", | ||
| # "syncstream", | ||
| "system_error", | ||
| "thread", | ||
| "tuple", | ||
| "type_traits", | ||
| "typeindex", | ||
| "typeinfo", | ||
| "unordered_map", | ||
| "unordered_set", | ||
| "utility", | ||
| "valarray", | ||
| "variant", | ||
| "vector", | ||
| "version", | ||
| ); | ||
|
|
||
| my $header_unit_options = ""; | ||
|
|
||
| foreach (@stl_headers) { | ||
| $header_unit_options .= " /headerUnit"; | ||
| $header_unit_options .= " $stl_include_dir/$_=$_.ifc"; | ||
| $header_unit_options .= " $_.obj"; | ||
|
|
||
| # TRANSITION, remove /DMSVC_INTERNAL_TESTING after all compiler bugs are fixed | ||
| Run::ExecuteCL("/DMSVC_INTERNAL_TESTING /exportHeader \"<$_>\" /Fo$_.obj"); | ||
| } | ||
|
|
||
| # TRANSITION, remove /DMSVC_INTERNAL_TESTING after all compiler bugs are fixed | ||
| Run::ExecuteCL("/DMSVC_INTERNAL_TESTING test.cpp /Fe$cwd.exe $header_unit_options"); | ||
| } | ||
| 1 |
19 changes: 19 additions & 0 deletions
19
tests/std/tests/P1502R1_standard_library_header_units/env.lst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| RUNALL_INCLUDE ..\..\..\universal_prefix.lst | ||
| RUNALL_CROSSLIST | ||
| PM_CL="/w14365 /D_ENFORCE_FACET_SPECIALIZATIONS=1" | ||
| RUNALL_CROSSLIST | ||
| PM_CL="/w14640 /Zc:threadSafeInit- /EHsc /std:c++latest" | ||
| RUNALL_CROSSLIST | ||
| PM_CL="/Zc:preprocessor /D_SILENCE_CXX17_STRSTREAM_DEPRECATION_WARNING" | ||
| RUNALL_CROSSLIST | ||
| PM_CL="/MD" | ||
| PM_CL="/MDd" | ||
| PM_CL="/MT" | ||
| PM_CL="/MTd" | ||
| # RUNALL_CROSSLIST | ||
| # PM_CL="" | ||
| # PM_CL="/analyze:only" # TRANSITION, works correctly but slowly | ||
StephanTLavavej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # PM_CL="/BE" # TRANSITION, VSO-1232145 "EDG ICEs when consuming Standard Library Header Units" | ||
10 changes: 10 additions & 0 deletions
10
tests/std/tests/P1502R1_standard_library_header_units/lit.local.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| import P1502R1_standard_library_header_units.custom_format | ||
|
|
||
| config.test_format = \ | ||
| P1502R1_standard_library_header_units.custom_format.CustomTestFormat(config.test_format.cxx, | ||
| config.test_format.execute_external, | ||
| config.test_format.build_executor, | ||
| config.test_format.test_executor) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.