[libc] Add a macro to include/exclude subprocess tests.
This is useful when bringing up LLVM libc on a new OS on which we do not yet have the subprocess related helper functions.
This commit is contained in:
parent
f4c8fd12d5
commit
6344a583ca
|
@ -262,6 +262,8 @@ bool Test::testMatch(bool MatchResult, MatcherBase &Matcher, const char *LHSStr,
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SUBPROCESS_TESTS
|
||||
|
||||
bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal,
|
||||
const char *LHSStr, const char *RHSStr,
|
||||
const char *File, unsigned long Line) {
|
||||
|
@ -344,6 +346,7 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode,
|
|||
return false;
|
||||
}
|
||||
|
||||
#endif // ENABLE_SUBPROCESS_TESTS
|
||||
} // namespace testing
|
||||
} // namespace __llvm_libc
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
// This file can only include headers from utils/CPP/ or utils/testutils. No
|
||||
// other headers should be included.
|
||||
|
||||
#include "PlatformDefs.h"
|
||||
|
||||
#include "utils/CPP/TypeTraits.h"
|
||||
#include "utils/testutils/ExecuteFunction.h"
|
||||
#include "utils/testutils/StreamWrapper.h"
|
||||
|
@ -360,6 +362,8 @@ template <typename... Types> using TypeList = internal::TypeList<Types...>;
|
|||
if (!EXPECT_FALSE(VAL)) \
|
||||
return
|
||||
|
||||
#ifdef ENABLE_SUBPROCESS_TESTS
|
||||
|
||||
#define EXPECT_EXITS(FUNC, EXIT) \
|
||||
this->testProcessExits(__llvm_libc::testing::Test::createCallable(FUNC), \
|
||||
EXIT, #FUNC, #EXIT, __FILE__, __LINE__)
|
||||
|
@ -380,6 +384,8 @@ template <typename... Types> using TypeList = internal::TypeList<Types...>;
|
|||
#define __CAT(a, b) __CAT1(a, b)
|
||||
#define UNIQUE_VAR(prefix) __CAT(prefix, __LINE__)
|
||||
|
||||
#endif // ENABLE_SUBPROCESS_TESTS
|
||||
|
||||
#define EXPECT_THAT(MATCH, MATCHER) \
|
||||
do { \
|
||||
auto UNIQUE_VAR(__matcher) = (MATCHER); \
|
||||
|
|
16
libc/utils/UnitTest/PlatformDefs.h
Normal file
16
libc/utils/UnitTest/PlatformDefs.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
//===-- Platform specific defines for the unittest library ------*- C++ -*-===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_UTILS_UNITTEST_PLATFORMDEFS_H
|
||||
#define LLVM_LIBC_UTILS_UNITTEST_PLATFORMDEFS_H
|
||||
|
||||
#if !(defined(_WIN32) || defined(_WIN64))
|
||||
#define ENABLE_SUBPROCESS_TESTS
|
||||
#endif
|
||||
|
||||
#endif // LLVM_LIBC_UTILS_UNITTEST_PLATFORMDEFS_H
|
Loading…
Reference in a new issue