Skip to content

Commit

Permalink
Add tr1 testsuite (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbezault authored Mar 30, 2020
1 parent ff83542 commit 811c8c1
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 1 deletion.
9 changes: 9 additions & 0 deletions azure-devops/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/libcxx/skipped_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions tests/tr1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions tests/tr1/expected_results.txt
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
29 changes: 29 additions & 0 deletions tests/tr1/lit.cfg
Original file line number Diff line number Diff line change
@@ -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()
18 changes: 18 additions & 0 deletions tests/tr1/lit.site.cfg.in
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 2 additions & 0 deletions tests/tr1/tests/cwchar1/__init__.py
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
17 changes: 17 additions & 0 deletions tests/tr1/tests/cwchar1/custom_format.py
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions tests/tr1/tests/cwchar1/lit.local.cfg
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 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)

0 comments on commit 811c8c1

Please sign in to comment.