Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
7515060
Update LLVM reference
CaseyCarter Jul 26, 2020
46f7b77
Merge branch 'master' of https://github.com/microsoft/STL into HEAD
cbezault Oct 16, 2020
d4ff68b
Avoid relying on upstream libcxx lit.cfg
cbezault Oct 16, 2020
f62ad74
Skip bogus failing tests
CaseyCarter Oct 19, 2020
7a859cd
Apply suggestions from code review
CaseyCarter Oct 19, 2020
777d49b
Update LLVM reference to latest
cbezault Oct 19, 2020
5d3ee9a
Update atomic_init per P0883R3
CaseyCarter Oct 19, 2020
e46a162
Update LLVM reference once again
CaseyCarter Oct 20, 2020
40b5aac
Fix mis-formatted line in expected_results.txt
CaseyCarter Oct 20, 2020
16c00b2
Fix bad separators in libcxx/expected_results
CaseyCarter Oct 20, 2020
c72c9fd
Let's rewrite the test harness
cbezault Oct 23, 2020
0a379b4
Fix merge conflicts
cbezault Oct 23, 2020
8b3708f
Get past file validation
cbezault Oct 23, 2020
352715d
That's what I get for not testing x86
cbezault Oct 23, 2020
9bb228a
Undo unwanted changes to submodules fixup tests which embed /c flag
cbezault Oct 23, 2020
428a2fc
resolve merge conflict
cbezault Oct 23, 2020
0b5cdaf
Resolves GH-1382
cbezault Oct 23, 2020
1843c30
Merge branch 'master' of https://github.com/Microsoft/STL
cbezault Oct 23, 2020
1d3cc67
cleanup the new custom format
cbezault Oct 23, 2020
d6eab20
Fix broken custom format
cbezault Oct 23, 2020
f5d374c
Respect tests getting marked as unsupported
cbezault Oct 23, 2020
c332008
Fix .fail tests
cbezault Oct 23, 2020
d0cb477
STL_EDG_DROP at least does something now + other cleanups
cbezault Oct 23, 2020
9f400b0
Make handling the intellisense response file its own step type
cbezault Oct 23, 2020
dd9a2a2
Make all compile-only tests compile only
cbezault Oct 23, 2020
331017e
Actually find tests with new suffix
cbezault Oct 23, 2020
74660fd
Update format.py
cbezault Oct 29, 2020
5116e2c
Merge with master
cbezault Oct 31, 2020
82e8f41
Merge branch 'master' of github.com:cbezault/STL
cbezault Oct 31, 2020
be7e4a4
Fix a bug that STL found
cbezault Nov 1, 2020
bad25da
Rebasing kernel harness on new test infrastructure
Nov 1, 2020
2fab494
Code review feedback.
StephanTLavavej Nov 2, 2020
73e08c6
Fix issue with expected results file. Integrate @ben-craig's suggestions
cbezault Nov 2, 2020
b91bb8b
It might be deprecated but pickling a tuple is faster than pickling a…
cbezault Nov 2, 2020
bf2381a
Resolve merge conflict
cbezault Nov 2, 2020
28f6864
clang format and some other small cleanups
cbezault Nov 2, 2020
54fa098
Update tests/utils/stl/test/format.py
cbezault Nov 3, 2020
0a7194c
Update tests/utils/stl/test/tests.py
cbezault Nov 3, 2020
25d73d5
Change `/analyze` to `/analyze:autolog-`.
StephanTLavavej Nov 3, 2020
691674b
Merge branch 'master' of github.com:cbezault/STL into kernel
cbezault Nov 3, 2020
2443db6
Light up kernel tests in CI
cbezault Nov 3, 2020
32377ab
clang-format
cbezault Nov 3, 2020
f0c62c3
Make validate happy
cbezault Nov 3, 2020
ad8a003
first kernel test
Nov 13, 2020
721cb3f
Point to the WDK
cbezault Dec 5, 2020
f7591e3
Merge master
cbezault Dec 5, 2020
51acb66
Fix line endings
cbezault Dec 5, 2020
5032e50
Merge pull request #10 from ben-craig/envlst2
cbezault Dec 5, 2020
4640507
clang-format
cbezault Dec 5, 2020
33319b4
Suppress 5040 in the WDK
cbezault Dec 5, 2020
dc58334
Make everything more verbose (maybe)
cbezault Dec 7, 2020
e910d81
Add a linking pragma
cbezault Dec 7, 2020
4f3b0fa
Handle calling convention differences
Dec 18, 2020
f041be3
Update tests.py
cbezault Dec 21, 2020
593f49a
Merge pull request #11 from ben-craig/kernel3
cbezault Dec 21, 2020
6f78416
clang-format
cbezault Dec 21, 2020
db798ef
Always compile kernel tests, but only run on amd64
Dec 23, 2020
3886633
Update format.py
cbezault Jan 4, 2021
bd9f7e4
Merge pull request #12 from ben-craig/kernel4
cbezault Jan 4, 2021
ba553ad
Update format.py
cbezault Jan 4, 2021
e31ce62
Merge branch 'main' into kernel
StephanTLavavej Feb 14, 2021
99e3d46
Define CMAKE_CXX_FLAGS and STL_IS_KERNEL on separate lines.
StephanTLavavej Feb 14, 2021
aca1692
Merge branch 'main' into local_kernel
ben-craig May 16, 2021
f44db64
STL review comments
ben-craig May 16, 2021
5f85051
Merge branch 'main' into kernel5
ben-craig Jul 4, 2021
eca3926
fixed trailing whitespace
ben-craig Jul 4, 2021
f2415f3
Adding an explicit admin check, for both usability and debugging purp…
ben-craig Jul 18, 2021
23ba14b
line wrapping to get under the 120 char limit
ben-craig Jul 18, 2021
eefbb76
Adding extra diagnostic information, so we can tell which account is …
ben-craig Jul 19, 2021
c975638
seeing if CI is agreeable with not installing certs to root and trust…
ben-craig Jul 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if("${Boost_VERSION}" VERSION_LESS "${VCLIBS_MIN_BOOST_VERSION}")
endif()

option(BUILD_TESTING "Enable testing" ON)
option(STL_IS_KERNEL "Enable kernel testing" OFF)
set(VCLIBS_SUFFIX "_oss" CACHE STRING "suffix for built DLL names to avoid conflicts with distributed DLLs")

if(NOT DEFINED VCLIBS_TARGET_ARCHITECTURE)
Expand Down
6 changes: 5 additions & 1 deletion azure-devops/cmake-configure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ steps:
-DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DLIT_FLAGS=$(litFlags) ^
-DCMAKE_CXX_FLAGS=/analyze:autolog- ^
-DCMAKE_CXX_FLAGS="/analyze:autolog-" ^
-DSTL_IS_KERNEL=ON ^
-DWDK_INCLUDE_DIRECTORY="C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0" ^
-DWDK_LIB_DIRECTORY="C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0" ^
-DWDK_BIN_DIRECTORY="C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0" ^
-S $(Build.SourcesDirectory) -B $(${{ parameters.buildOutputLocationVar }})
displayName: 'Configure the STL'
timeoutInMinutes: 2
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fixedFlags: '--timeout=240;--shuffle'
parallelismFlag: '-j$(testParallelism)'
xmlOutputFlag: '--xunit-xml-output=$(${{ parameters.buildOutputLocationVar }})/test-results.xml'
shardFlags: '--num-shards=$(System.TotalJobsInPhase);--run-shard=$(System.JobPositionInPhase)'
shardFlags: '-vv;--num-shards=$(System.TotalJobsInPhase);--run-shard=$(System.JobPositionInPhase)'
litFlags: '$(fixedFlags);$(parallelismFlag);$(xmlOutputFlag);$(shardFlags)'
strategy:
parallel: ${{ parameters.numShards }}
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/native-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fixedFlags: '--timeout=240;--shuffle'
parallelismFlag: '-j$(testParallelism)'
xmlOutputFlag: '--xunit-xml-output=$(${{ parameters.buildOutputLocationVar }})/test-results.xml'
shardFlags: '--num-shards=$(System.TotalJobsInPhase);--run-shard=$(System.JobPositionInPhase)'
shardFlags: '-vv;--num-shards=$(System.TotalJobsInPhase);--run-shard=$(System.JobPositionInPhase)'
litFlags: '$(fixedFlags);$(parallelismFlag);$(xmlOutputFlag);$(shardFlags)'
strategy:
parallel: ${{ parameters.numShards }}
Expand Down
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ option(TESTS_BUILD_ONLY "Only run the build steps of tests" OFF)
add_subdirectory(libcxx)
add_subdirectory(std)
add_subdirectory(tr1)
if(STL_IS_KERNEL)
add_subdirectory(utils/kernel)
endif()

# Add the stl-lit subdirectory last so all the test directories have had a
# chance to add to the config map and test directory global properties.
Expand Down
7 changes: 7 additions & 0 deletions tests/libcxx/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ lit_config.cxx_runtime = '@CMAKE_RUNTIME_OUTPUT_DIRECTORY@'
lit_config.target_arch = '@VCLIBS_TARGET_ARCHITECTURE@'
lit_config.build_only = '@TESTS_BUILD_ONLY@'.lower() in ['1', 'true', 'on']

lit_config.is_kernel = '@STL_IS_KERNEL@'.lower() in ['1', 'true', 'on']
if lit_config.is_kernel:
lit_config.wdk_include = "@WDK_INCLUDE_DIRECTORY@"
lit_config.wdk_lib = "@WDK_LIB_DIRECTORY@"
lit_config.wdk_bin = "@WDK_BIN_DIRECTORY@"
lit_config.utils_dir = "@STL_TEST_UTILS_DIR@"

# Add parameters and features to the config
stl.test.config.configure(
stl.test.params.getDefaultParameters(config, lit_config),
Expand Down
7 changes: 7 additions & 0 deletions tests/std/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ lit_config.cxx_runtime = '@CMAKE_RUNTIME_OUTPUT_DIRECTORY@'
lit_config.target_arch = '@VCLIBS_TARGET_ARCHITECTURE@'
lit_config.build_only = '@TESTS_BUILD_ONLY@'.lower() in ['1', 'true', 'on']

lit_config.is_kernel = '@STL_IS_KERNEL@'.lower() in ['1', 'true', 'on']
if lit_config.is_kernel:
lit_config.wdk_include = "@WDK_INCLUDE_DIRECTORY@"
lit_config.wdk_lib = "@WDK_LIB_DIRECTORY@"
lit_config.wdk_bin = "@WDK_BIN_DIRECTORY@"
lit_config.utils_dir = "@STL_TEST_UTILS_DIR@"

# Add parameters and features to the config
stl.test.config.configure(
stl.test.params.getDefaultParameters(config, lit_config),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\impure_matrix.lst
RUNALL_INCLUDE ..\kernel.lst
14 changes: 13 additions & 1 deletion tests/std/tests/Dev11_0863628_atomic_compare_exchange/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <string.h>
#include <type_traits>


using namespace std;

#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
Expand Down Expand Up @@ -503,12 +502,25 @@ void test_layout_paranoia() {
assert(b[2] == 3);
}

#ifdef _KERNEL_MODE

#define assert_bitwise_identical(MSG, LHS, RHS) \
{ \
double lhs = LHS; \
double rhs = RHS; \
if (memcmp(&lhs, &rhs, sizeof(lhs)) != 0) { \
assert(!MSG); \
} \
}

#else // _KERNEL_MODE
void assert_bitwise_identical(const char* const msg, const double lhs, const double rhs) {
if (memcmp(&lhs, &rhs, sizeof(lhs)) != 0) {
printf("counterexample found in %s: %a and %a\n", msg, lhs, rhs);
abort();
}
}
#endif // _KERNEL_MODE

void test_double_identical_results() {
#if _HAS_CXX20
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/kernel.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

PM_CL="/kernel /Zc:preprocessor /std:c++latest /w14640 /Zc:threadSafeInit- /DNO_TEST_ENVIRONMENT_PREPARER" PM_LINK="/IGNORE:4210 /subsystem:native /nodefaultlib stl_kernel.lib BufferOverflowFastFailK.lib ntoskrnl.lib hal.lib wmilib.lib Ntstrsafe.lib libcpmt.lib libcmt.lib"
7 changes: 7 additions & 0 deletions tests/tr1/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ lit_config.cxx_runtime = '@CMAKE_RUNTIME_OUTPUT_DIRECTORY@'
lit_config.target_arch = '@VCLIBS_TARGET_ARCHITECTURE@'
lit_config.build_only = '@TESTS_BUILD_ONLY@'.lower() in ['1', 'true', 'on']

lit_config.is_kernel = '@STL_IS_KERNEL@'.lower() in ['1', 'true', 'on']
if lit_config.is_kernel:
lit_config.wdk_include = "@WDK_INCLUDE_DIRECTORY@"
lit_config.wdk_lib = "@WDK_LIB_DIRECTORY@"
lit_config.wdk_bin = "@WDK_BIN_DIRECTORY@"
lit_config.utils_dir = "@STL_TEST_UTILS_DIR@"

# Add parameters and features to the config
stl.test.config.configure(
stl.test.params.getDefaultParameters(config, lit_config),
Expand Down
52 changes: 52 additions & 0 deletions tests/utils/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set(STL_KERNEL_LOADER_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/stl_kernel_loader/testapp.cpp
${CMAKE_CURRENT_LIST_DIR}/src/stl_kernel_loader/install.cpp
)

set(STL_KERNEL_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/stl_kernel/doAssert.cpp
${CMAKE_CURRENT_LIST_DIR}/src/stl_kernel/stl_kernel.cpp
)

add_library(stl_kernel STATIC ${STL_KERNEL_SOURCES})
set_target_properties(stl_kernel PROPERTIES LINKER_LANGUAGE CXX)
target_compile_definitions(stl_kernel PRIVATE "__STL_IS_KERNEL")

# ${WDK_INCLUDE_DIRECTORY}/km/crt isn't in the files under test include paths.
# doAssert.cpp wants to use RtlStringCbPrintfExA, and that requires pulling in
# km/crt. If we don't pull in km/crt here, we erroneously pull in user mode
# crt headers, and that gets us linker errors dealing with missing user mode
# symbols in this kernel mode binary.
target_include_directories(stl_kernel PRIVATE
${CMAKE_CURRENT_LIST_DIR}/inc
${WDK_INCLUDE_DIRECTORY}/km
${WDK_INCLUDE_DIRECTORY}/km/crt
${WDK_INCLUDE_DIRECTORY}/shared
)

# TRANSITION, WDK needs to suppress C5040
if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x86")
set(STL_KERNEL_CALLING_CONVENTION "/Gz")
else()
set(STL_KERNEL_CALLING_CONVENTION "")
endif()

target_compile_options(stl_kernel PRIVATE /kernel /wd5040 ${STL_KERNEL_CALLING_CONVENTION})

add_executable(stl_kernel_loader ${STL_KERNEL_LOADER_SOURCES})
target_include_directories(stl_kernel_loader PRIVATE
${CMAKE_CURRENT_LIST_DIR}/inc
${WDK_INCLUDE_DIRECTORY}/ucrt
${WDK_INCLUDE_DIRECTORY}/um
${WDK_INCLUDE_DIRECTORY}/shared
)
target_compile_options(stl_kernel_loader PRIVATE /EHsc)
target_link_libraries(stl_kernel_loader PRIVATE
msvcrt.lib
kernel32.lib
ucrt.lib
AdvApi32.lib
)
30 changes: 30 additions & 0 deletions tests/utils/kernel/generateMsvcCert.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

param([string]$out="MsvcStlTestingCert.pfx",[string]$pass="placeholderPassword")

$ErrorActionPreference = 'Stop'

$currentIdentity = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent())
#$isAdmin = $currentIdentity.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
#if (!$isAdmin) {
# $name = [Security.Principal.WindowsIdentity]::GetCurrent().Name
# Throw "The current prompt is not an elevated administrator prompt! Running as $name"
#}

# , cert:\localmachine\root, cert:\localmachine\trustedpublisher |
# Clean up old certificates
Get-ChildItem cert:\currentUser\My
Where-Object { $_.Subject -eq 'CN=MsvcStlTestingCert' } |
Remove-Item

# Make the new cert
$cert = New-SelfSignedCertificate -Type CodeSigningCert -DnsName "MsvcStlTestingCert" `
-certstorelocation cert:\currentUser\my -NotAfter (Get-Date).AddDays(2)
$path = 'cert:\currentUser\my\' + $cert.thumbprint
$pwd = ConvertTo-SecureString -String $pass -Force -AsPlainText
Export-PfxCertificate -cert $path -FilePath $out -Password $pwd

# install the cert so that we can load our drivers
# Import-PfxCertificate -FilePath $out -CertStoreLocation cert:\localmachine\root -Password $pwd
# Import-PfxCertificate -FilePath $out -CertStoreLocation cert:\localmachine\trustedpublisher -Password $pwd
4 changes: 4 additions & 0 deletions tests/utils/kernel/inc/assert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <cassert>
23 changes: 23 additions & 0 deletions tests/utils/kernel/inc/cassert
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

extern int* g_test_failures;
extern char* g_output_buffer;
extern size_t g_space_available;
void doAssert(const char* file, int line, const char* expr);

#undef assert
#define assert(x) \
if (!(x)) { \
doAssert(__FILE__, __LINE__, #x); \
}

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions tests/utils/kernel/inc/stl_kernel/kernel_test_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// This header is intended to be force included into the .cpp under test.
// KERNEL_TEST_NAME will then be provided as a /D switch and preprocessor
// concatenated into one big string literal.
extern const wchar_t* const STL_KERNEL_NT_DEVICE_NAME = L"\\Device\\" KERNEL_TEST_NAME;
extern const wchar_t* const STL_KERNEL_DOS_DEVICE_NAME = L"\\DosDevices\\" KERNEL_TEST_NAME;
19 changes: 19 additions & 0 deletions tests/utils/kernel/inc/stl_kernel/stl_kernel.h
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

#pragma once

#ifdef __STL_IS_KERNEL
#include <ntddk.h>
#else
#include <winioctl.h>
#endif

#define IOCTL_SIOCTL_METHOD_RUN_TEST CTL_CODE(40000, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)

struct TestResults {
int main_return;
int tests_failed;
// arbitrary buffer size, chosen to make the structure a "round" 4K
char output[4088];
};
26 changes: 26 additions & 0 deletions tests/utils/kernel/src/stl_kernel/doAssert.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "test_decls.h"
#include <Ntstrsafe.h>
#include <ntddk.h>

KGUARDED_MUTEX g_assert_mutex;
extern "C" {
int* g_test_failures;
char* g_output_buffer;
size_t g_space_available;
}

static const char ASSERTION_FAILED[] = "assertion failed ";
static const size_t ASSERTION_FAILED_LEN = sizeof(ASSERTION_FAILED) - 1;
extern "C" void doAssert(const char* file, int line, const char* expr) {
KeAcquireGuardedMutex(&g_assert_mutex);
++(*g_test_failures);

RtlStringCbPrintfExA(g_output_buffer, g_space_available, &g_output_buffer, &g_space_available,
0, // flags
"assertion failed %s(%d): %s\n", file, line, expr);

KeReleaseGuardedMutex(&g_assert_mutex);
}
Loading