-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathmain.cpp
64 lines (50 loc) · 1.74 KB
/
main.cpp
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
59
60
61
62
63
64
/*******************************************************************************
//
// SYCL 2020 Conformance Test Suite
//
// Copyright (c) 2021 The Khronos Group Inc.
//
*******************************************************************************/
#include <regex>
#include <string>
#define CATCH_CONFIG_RUNNER
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/internal/catch_clara.hpp>
#include "./../../util/device_manager.h"
#include "cts_selector.h"
int main(int argc, char** argv) {
using namespace sycl_cts;
Catch::Session session;
session.configData().name = "The SYCL 2020 Conformance Test Suite";
std::string devicePattern;
std::string infoDumpFile;
bool listDevices = false;
using namespace Catch::Clara;
// TODO: Look into removing some of Catch2's default options
// that we don't need, e.g. for benchmarking.
auto cli = Opt(devicePattern, "pattern")["--device"](
"Select SYCL device to run CTS on. ECMAScript "
"regular expression syntax can be used") |
Opt(listDevices)["--list-devices"]("List all available devices") |
Opt(infoDumpFile, "file")["--info-dump"](
"Dump platform and device info to file") |
session.cli();
session.cli(cli);
const int returnCode = session.applyCommandLine(argc, argv);
if (returnCode != 0) {
return returnCode;
}
auto& device_mngr = util::get<util::device_manager>();
if (!devicePattern.empty()) {
device_mngr.set_device_regex(std::regex(devicePattern));
}
if (listDevices) {
device_mngr.list_devices();
return EXIT_SUCCESS;
}
if (!infoDumpFile.empty()) {
device_mngr.dump_info(infoDumpFile);
}
return session.run();
}