From 811c8c181626382ee26ea85e6963843cb17ce53e Mon Sep 17 00:00:00 2001 From: Curtis J Bezault Date: Sun, 29 Mar 2020 18:16:33 -0700 Subject: [PATCH] Add tr1 testsuite (#652) --- azure-devops/run-build.yml | 9 ++++++++ tests/CMakeLists.txt | 3 ++- tests/libcxx/expected_results.txt | 1 + tests/libcxx/skipped_tests.txt | 1 + tests/tr1/CMakeLists.txt | 27 ++++++++++++++++++++++ tests/tr1/expected_results.txt | 2 ++ tests/tr1/lit.cfg | 29 ++++++++++++++++++++++++ tests/tr1/lit.site.cfg.in | 18 +++++++++++++++ tests/tr1/tests/cwchar1/__init__.py | 2 ++ tests/tr1/tests/cwchar1/custom_format.py | 17 ++++++++++++++ tests/tr1/tests/cwchar1/lit.local.cfg | 10 ++++++++ 11 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 tests/tr1/CMakeLists.txt create mode 100644 tests/tr1/expected_results.txt create mode 100644 tests/tr1/lit.cfg create mode 100644 tests/tr1/lit.site.cfg.in create mode 100644 tests/tr1/tests/cwchar1/__init__.py create mode 100644 tests/tr1/tests/cwchar1/custom_format.py create mode 100644 tests/tr1/tests/cwchar1/lit.local.cfg diff --git a/azure-devops/run-build.yml b/azure-devops/run-build.yml index 813dc929b..afe6304e4 100644 --- a/azure-devops/run-build.yml +++ b/azure-devops/run-build.yml @@ -109,3 +109,12 @@ jobs: testResultsFormat: JUnit testResultsFiles: '**/std.test.xml' testRunTitle: 'std-${{ parameters.targetPlatform }}' + - task: PublishTestResults@2 + displayName: 'Publish tr1 Tests' + timeoutInMinutes: 10 + condition: in('${{ parameters.targetPlatform }}', 'x64', 'x86') + inputs: + searchFolder: $(Build.ArtifactStagingDirectory)/${{ parameters.targetPlatform }} + testResultsFormat: JUnit + testResultsFiles: '**/tr1.test.xml' + testRunTitle: 'tr1-${{ parameters.targetPlatform }}' diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 17ac762f8..7e31179cb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,8 +31,9 @@ set(LLVM_LIT_LOCATION "${LIT_BASE_DIR}/${LIT_FILE_NAME}") set(Python_FIND_STRATEGY VERSION) find_package(Python3) -add_subdirectory(std) add_subdirectory(libcxx) +add_subdirectory(std) +add_subdirectory(tr1) # Add the llvm-lit subdirectory last so all the test directories have had a # chance to add to the config map. diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 0f374acb7..39a88e491 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -732,6 +732,7 @@ std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp SKIP std/thread/futures/futures.async/async.pass.cpp SKIP std/thread/futures/futures.shared_future/get.pass.cpp SKIP std/thread/futures/futures.shared_future/wait_for.pass.cpp SKIP +std/thread/futures/futures.shared_future/wait.pass.cpp SKIP std/thread/futures/futures.unique_future/wait_for.pass.cpp SKIP std/thread/futures/futures.unique_future/wait.pass.cpp SKIP std/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp SKIP diff --git a/tests/libcxx/skipped_tests.txt b/tests/libcxx/skipped_tests.txt index 820985d81..27551a817 100644 --- a/tests/libcxx/skipped_tests.txt +++ b/tests/libcxx/skipped_tests.txt @@ -732,6 +732,7 @@ utilities\utility\pairs\pairs.pair\assign_pair.pass.cpp thread\futures\futures.async\async.pass.cpp thread\futures\futures.shared_future\get.pass.cpp thread\futures\futures.shared_future\wait_for.pass.cpp +thread\futures\futures.shared_future\wait.pass.cpp thread\futures\futures.unique_future\wait_for.pass.cpp thread\futures\futures.unique_future\wait.pass.cpp thread\thread.condition\thread.condition.condvar\notify_all.pass.cpp diff --git a/tests/tr1/CMakeLists.txt b/tests/tr1/CMakeLists.txt new file mode 100644 index 000000000..74f14e26a --- /dev/null +++ b/tests/tr1/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +set(TR1_EXPECTED_RESULTS "${CMAKE_CURRENT_SOURCE_DIR}/expected_results.txt") +set(TR1_TEST_OUTPUT_DIR "${STL_TEST_OUTPUT_DIR}/tr1") +set(TR1_TEST_SUBDIRS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/test.lst") +set(TR1_TEST_SUBDIRS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) + +get_property(LLVM_LIT_CONFIG_MAP GLOBAL PROPERTY LLVM_LIT_CONFIG_MAP) +string(APPEND LLVM_LIT_CONFIG_MAP "map_config(\"${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg\", \"${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg\")\n") +set_property(GLOBAL PROPERTY LLVM_LIT_CONFIG_MAP ${LLVM_LIT_CONFIG_MAP}) + +if(ENABLE_XUNIT_OUTPUT) + list(APPEND TR1_ADDITIONAL_LIT_FLAGS "--xunit-xml-output" "${CMAKE_CURRENT_BINARY_DIR}/tr1.test.xml") +endif() + +list(APPEND TR1_LLVM_LIT_COMMAND "${LLVM_LIT_LOCATION}" + "${ADDITIONAL_LIT_FLAGS}" + "${TR1_ADDITIONAL_LIT_FLAGS}" + "${CMAKE_CURRENT_BINARY_DIR}") + +add_test(NAME tr1 COMMAND ${Python3_EXECUTABLE} ${TR1_LLVM_LIT_COMMAND} COMMAND_EXPAND_LISTS) +set_tests_properties(tr1 PROPERTIES RUN_SERIAL TRUE) diff --git a/tests/tr1/expected_results.txt b/tests/tr1/expected_results.txt new file mode 100644 index 000000000..2ac2a854c --- /dev/null +++ b/tests/tr1/expected_results.txt @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/tests/tr1/lit.cfg b/tests/tr1/lit.cfg new file mode 100644 index 000000000..0b68aa927 --- /dev/null +++ b/tests/tr1/lit.cfg @@ -0,0 +1,29 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +from pathlib import Path +import importlib +import site + +site.addsitedir(str(Path(__file__).parents[1] / "utils")) +site.addsitedir(str(Path(__file__).parent / "tests")) + +config.name = 'tr1' +config.suffixes.add('test.cpp') + +if config.test_source_root is None: + config.test_source_root = str(Path(__file__).parent) + +config.test_exec_root = getattr(config, 'test_exec_root', None) + +if not config.test_exec_root: + import tempfile + config.test_exec_root = tempfile.mkdtemp(prefix=config.name + '-testsuite-') + lit_config.note('Creating temporary directory for tests: %s' % config.test_exec_root) + +config_module_name = getattr(config, 'config_module_name', 'stl.test.config') +config_module = importlib.import_module(config_module_name) + +configuration = config_module.Configuration(lit_config, config) +configuration.configure() +config.test_format = configuration.get_test_format() diff --git a/tests/tr1/lit.site.cfg.in b/tests/tr1/lit.site.cfg.in new file mode 100644 index 000000000..56b631e9d --- /dev/null +++ b/tests/tr1/lit.site.cfg.in @@ -0,0 +1,18 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +config.cxx_archive_root = "@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@" +config.cxx_headers = "@STL_TESTED_HEADERS_DIR@" +config.cxx_library_root = "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" +config.cxx_runtime_root = "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@" +config.expected_results_list_path = "@TR1_EXPECTED_RESULTS@" +config.include_dirs = ["@STL_SOURCE_DIR@/tests/tr1/include"] +config.msvc_toolset_libs_root = "@TOOLSET_LIB@" +config.stl_build_root = "@STL_BUILD_ROOT@" +config.stl_src_root = "@STL_SOURCE_DIR@" +config.target_arch = "@VCLIBS_TARGET_ARCHITECTURE@" +config.test_exec_root = "@TR1_TEST_OUTPUT_DIR@" +config.test_subdirs_file = "@TR1_TEST_SUBDIRS_FILE@" +config.test_subdirs_root = "@TR1_TEST_SUBDIRS_ROOT@" + +lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg") diff --git a/tests/tr1/tests/cwchar1/__init__.py b/tests/tr1/tests/cwchar1/__init__.py new file mode 100644 index 000000000..2ac2a854c --- /dev/null +++ b/tests/tr1/tests/cwchar1/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/tests/tr1/tests/cwchar1/custom_format.py b/tests/tr1/tests/cwchar1/custom_format.py new file mode 100644 index 000000000..456c91bb9 --- /dev/null +++ b/tests/tr1/tests/cwchar1/custom_format.py @@ -0,0 +1,17 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +from stl.test.format import STLTestFormat, TestStep + + +class CustomTestFormat(STLTestFormat): + def getTestSteps(self, test, lit_config, shared): + if shared.exec_file is None: + for step in super().getTestSteps(test, lit_config, shared): + yield step + else: + exec_env = test.cxx.compile_env + exec_env['TMP'] = str(shared.exec_dir) + + yield TestStep([str(shared.exec_file)], shared.exec_dir, + [shared.exec_file], exec_env) diff --git a/tests/tr1/tests/cwchar1/lit.local.cfg b/tests/tr1/tests/cwchar1/lit.local.cfg new file mode 100644 index 000000000..c1dd34543 --- /dev/null +++ b/tests/tr1/tests/cwchar1/lit.local.cfg @@ -0,0 +1,10 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +import cwchar1.custom_format + +config.test_format = \ + cwchar1.custom_format.CustomTestFormat(config.test_format.cxx, + config.test_format.execute_external, + config.test_format.build_executor, + config.test_format.test_executor)