| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
/// |
| 9 |
/// \file |
| 10 |
/// This file contains the definition of the command-line options and the |
| 11 |
/// implementation of the logic for selecting test configurations. |
| 12 |
/// |
| 13 |
//===----------------------------------------------------------------------===// |
| 14 |
|
| 15 |
#include "mathtest/CommandLineExtras.hpp" |
| 16 |
|
| 17 |
#include "mathtest/CommandLine.hpp" |
| 18 |
#include "mathtest/TestConfig.hpp" |
| 19 |
|
| 20 |
#include "llvm/ADT/SmallVector.h" |
| 21 |
#include "llvm/Support/CommandLine.h" |
| 22 |
|
| 23 |
using namespace mathtest; |
| 24 |
|
| 25 |
llvm::cl::opt<bool> mathtest::cl::IsVerbose( |
| 26 |
"verbose", |
| 27 |
llvm::cl::desc("Enable verbose output for failed and unsupported tests"), |
| 28 |
llvm::cl::init(false)); |
| 29 |
|
| 30 |
llvm::cl::opt<llvm::cl::TestConfigsArg> mathtest::cl::detail::TestConfigsOpt( |
| 31 |
"test-configs", llvm::cl::Optional, |
| 32 |
llvm::cl::desc("Select test configurations"), |
| 33 |
llvm::cl::value_desc("all|provider:platform[,provider:platform...]")); |
| 34 |
|
| 35 |
const llvm::SmallVector<TestConfig, 4> &mathtest::cl::getTestConfigs() { |
| 36 |
switch (detail::TestConfigsOpt.Mode) { |
| 37 |
case llvm::cl::TestConfigsArg::Mode::Default: |
| 38 |
return getDefaultTestConfigs(); |
| 39 |
case llvm::cl::TestConfigsArg::Mode::All: |
| 40 |
return getAllTestConfigs(); |
| 41 |
case llvm::cl::TestConfigsArg::Mode::Explicit: |
| 42 |
return detail::TestConfigsOpt.Explicit; |
| 43 |
} |
| 44 |
llvm_unreachable("Unknown TestConfigsArg mode"); |
| 45 |
} |