-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsbuild.cpp
More file actions
58 lines (46 loc) · 1.65 KB
/
Copy pathmsbuild.cpp
File metadata and controls
58 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <catch2/catch.hpp>
#include <filesystem>
#include <stdlib.h>
#include "test_config.h"
#include "cmd_line_utils.h"
#include "util.h"
#include "system_test.h"
namespace fs = std::filesystem;
namespace msbuild {
ConfigString cfg_run_one { "msbuild-run-one", "" };
ConfigString cfg_run_set { "msbuild-run-set", "dag,concurrent,generated" };
ConfigString cfg_generator { "msbuild-generator", "Visual Studio 16 2019" };
ConfigString cfg_arch { "msbuild-arch", "Win32" };
ConfigString cfg_verbosity { "msbuild-verbosity", "m", "m for mininmal, d for diagnostic" };
ConfigString cfg_configuration { "msbuild-configuration", "Debug" };
ConfigString cfg_toolset { "msbuild-toolset", "" };
struct path_guard {
std::string path_env = getenv("PATH");
path_guard() { putenv((char*)fmt::format("PATH={};C:\\Program Files\\LLVM\\bin", path_env).c_str()); }
~path_guard() { putenv((char*)fmt::format("PATH={}", path_env).c_str()); }
};
using namespace system_test;
TEST_CASE("msbuild system test", "[msbuild]") {
// todo: ideally CMake should be able to generate its CompilerIdCXX.vcxproj
// with the LLVMInstallDir set so that we don't need to change the path here
path_guard pguard;
auto guard = make_chdir_guard();
run_one_params params {
.generator = cfg_generator,
.arch = cfg_arch,
.toolset = cfg_toolset,
.verbosity = cfg_verbosity,
.configuration = cfg_configuration
};
for (std::string& test : get_run_set(cfg_run_one, cfg_run_set)) {
full_clean_one(test);
params.toolset = cfg_toolset;
run_one(test, params);
if (cfg_toolset == "") {
full_clean_one(test);
params.toolset = "ClangCl";
run_one(test, params);
}
}
}
} // namespace msbuild