Files
clang-p2996/libc/utils/UnitTest/LibcTestMain.cpp
Caitlyn Cano fa7a9ef178 [libc] Add option to run specific tests
This addition reads command line input to run specific single tests
within a larger call to run all the tests for a particular function.
When the user adds a second argument to the command line, the code skips
all the tests that don't match the user's specified binary. If the user
doesn't specify a test correctly and/or no tests are run, a failure
message prints.

Reviewed By: sivachandra, aeubanks

Differential Revision: https://reviews.llvm.org/D105843
2021-07-23 16:08:13 +00:00

19 lines
644 B
C++

//===-- Main function for implementation of base class for libc unittests -===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "LibcTest.h"
static const char *getTestFilter(int argc, char *argv[]) {
return argc > 1 ? argv[1] : nullptr;
}
int main(int argc, char *argv[]) {
const char *TestFilter = getTestFilter(argc, argv);
return __llvm_libc::testing::Test::runTests(TestFilter);
}