forked from OSchip/llvm-project
[RGT] Disable some tests on Windows at compile-time, not runtime
These show up as un-executed on non-Windows hosts. Found by the Rotten Green Tests project.
This commit is contained in:
parent
6ce76ff7eb
commit
206343f319
|
@ -47,14 +47,6 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool isWindows() {
|
||||
// FIXME: Skip some tests below on non-Windows because multi-socket systems
|
||||
// were not fully tested on Unix yet, and llvm::get_thread_affinity_mask()
|
||||
// isn't implemented for Unix.
|
||||
Triple Host(Triple::normalize(sys::getProcessTriple()));
|
||||
return Host.isOSWindows();
|
||||
}
|
||||
|
||||
ThreadPoolTest() {
|
||||
// Add unsupported configuration here, example:
|
||||
// UnsupportedArchs.push_back(Triple::x86_64);
|
||||
|
@ -94,12 +86,6 @@ protected:
|
|||
return; \
|
||||
} while (0);
|
||||
|
||||
#define SKIP_NON_WINDOWS() \
|
||||
do { \
|
||||
if (!isWindows()) \
|
||||
return; \
|
||||
} while (0);
|
||||
|
||||
TEST_F(ThreadPoolTest, AsyncBarrier) {
|
||||
CHECK_UNSUPPORTED();
|
||||
// test that async & barrier work together properly.
|
||||
|
@ -185,6 +171,11 @@ TEST_F(ThreadPoolTest, PoolDestruction) {
|
|||
|
||||
#if LLVM_ENABLE_THREADS == 1
|
||||
|
||||
// FIXME: Skip some tests below on non-Windows because multi-socket systems
|
||||
// were not fully tested on Unix yet, and llvm::get_thread_affinity_mask()
|
||||
// isn't implemented for Unix (need AffinityMask in Support/Unix/Program.inc).
|
||||
#ifdef _WIN32
|
||||
|
||||
std::vector<llvm::BitVector>
|
||||
ThreadPoolTest::RunOnAllSockets(ThreadPoolStrategy S) {
|
||||
llvm::SetVector<llvm::BitVector> ThreadsUsed;
|
||||
|
@ -221,14 +212,12 @@ ThreadPoolTest::RunOnAllSockets(ThreadPoolStrategy S) {
|
|||
|
||||
TEST_F(ThreadPoolTest, AllThreads_UseAllRessources) {
|
||||
CHECK_UNSUPPORTED();
|
||||
SKIP_NON_WINDOWS();
|
||||
std::vector<llvm::BitVector> ThreadsUsed = RunOnAllSockets({});
|
||||
ASSERT_EQ(llvm::get_cpus(), ThreadsUsed.size());
|
||||
}
|
||||
|
||||
TEST_F(ThreadPoolTest, AllThreads_OneThreadPerCore) {
|
||||
CHECK_UNSUPPORTED();
|
||||
SKIP_NON_WINDOWS();
|
||||
std::vector<llvm::BitVector> ThreadsUsed =
|
||||
RunOnAllSockets(llvm::heavyweight_hardware_concurrency());
|
||||
ASSERT_EQ(llvm::get_cpus(), ThreadsUsed.size());
|
||||
|
@ -247,9 +236,6 @@ static cl::opt<std::string> ThreadPoolTestStringArg1("thread-pool-string-arg1");
|
|||
TEST_F(ThreadPoolTest, AffinityMask) {
|
||||
CHECK_UNSUPPORTED();
|
||||
|
||||
// FIXME: implement AffinityMask in Support/Unix/Program.inc
|
||||
SKIP_NON_WINDOWS();
|
||||
|
||||
// Skip this test if less than 4 threads are available.
|
||||
if (llvm::hardware_concurrency().compute_thread_count() < 4)
|
||||
return;
|
||||
|
@ -258,8 +244,10 @@ TEST_F(ThreadPoolTest, AffinityMask) {
|
|||
if (getenv("LLVM_THREADPOOL_AFFINITYMASK")) {
|
||||
std::vector<llvm::BitVector> ThreadsUsed = RunOnAllSockets({});
|
||||
// Ensure the threads only ran on CPUs 0-3.
|
||||
// NOTE: Don't use ASSERT* here because this runs in a subprocess,
|
||||
// and will show up as un-executed in the parent.
|
||||
for (auto &It : ThreadsUsed)
|
||||
ASSERT_LT(It.getData().front(), 16UL);
|
||||
assert(It.getData().front() < 16UL);
|
||||
return;
|
||||
}
|
||||
std::string Executable =
|
||||
|
@ -280,4 +268,5 @@ TEST_F(ThreadPoolTest, AffinityMask) {
|
|||
ASSERT_EQ(0, Ret);
|
||||
}
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
#endif // #if LLVM_ENABLE_THREADS == 1
|
||||
|
|
Loading…
Reference in New Issue