Block building Tests in wrong command prompt by fsb4000 · Pull Request #4717 · microsoft/STL (original) (raw)

Thanks, this is super awesome and will prevent a common problem for contributors! 😻

I pushed a major simplification of the logic and improved the output:

D:\GitHub\STL\out\x64>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.41.33923 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

D:\GitHub\STL\out\x64>python tests\utils\stl-lit\stl-lit.py -o testing.log -Dnotags=ASAN --order=random --succinct %STL%\tests\std\tests\P0295R0_gcd_lcm
Target platform mismatch: the STL was built for x64 but tested for x86.

This works because CMake's configure_file transformations bake build_platform = '$ENV{Platform}' into out\x64\tests\utils\stl-lit\stl-lit.py containing:

def assert_same_platform_for_build_and_test(): build_platform = 'x64' test_platform = os.getenv('Platform', default='')

I also verified the reverse failure case, and successful cases.