Skip to content

Commit 3f26afc

Browse files
Try fix msvc test failures
1 parent aecf363 commit 3f26afc

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

llvm/include/llvm/CAS/ActionCache.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@ class ActionCache {
7272
return getImpl(arrayRefFromStringRef(ActionKey.getKey()), Globally);
7373
}
7474

75-
/// Asynchronous version of \c get.
76-
std::future<AsyncCASIDValue> getFuture(const CacheKey &ActionKey,
77-
bool Globally = false) const;
78-
79-
/// Asynchronous version of \c get.
80-
void getAsync(
81-
const CacheKey &ActionKey, bool Globally,
82-
unique_function<void(Expected<std::optional<CASID>>)> Callback) const {
83-
return getImplAsync(arrayRefFromStringRef(ActionKey.getKey()), Globally,
84-
std::move(Callback));
85-
}
86-
8775
/// Cache \p Result for the \p ActionKey computation.
8876
///
8977
/// \param Globally if true it is a hint to the underlying implementation that
@@ -97,6 +85,23 @@ class ActionCache {
9785
return putImpl(arrayRefFromStringRef(ActionKey.getKey()), Result, Globally);
9886
}
9987

88+
89+
#ifndef _MSC_VER
90+
/// FIXME: MSVC doesn't compile Error within Promise/Future correctly and will
91+
/// result in unchecked error. Disable AsyncAPIs when using MSVC for now.
92+
93+
/// Asynchronous version of \c get.
94+
std::future<AsyncCASIDValue> getFuture(const CacheKey &ActionKey,
95+
bool Globally = false) const;
96+
97+
/// Asynchronous version of \c get.
98+
void getAsync(
99+
const CacheKey &ActionKey, bool Globally,
100+
unique_function<void(Expected<std::optional<CASID>>)> Callback) const {
101+
return getImplAsync(arrayRefFromStringRef(ActionKey.getKey()), Globally,
102+
std::move(Callback));
103+
}
104+
100105
/// Asynchronous version of \c put.
101106
std::future<AsyncErrorValue> putFuture(const CacheKey &ActionKey,
102107
const CASID &Result,
@@ -111,6 +116,7 @@ class ActionCache {
111116
return putImplAsync(arrayRefFromStringRef(ActionKey.getKey()), Result,
112117
Globally, std::move(Callback));
113118
}
119+
#endif
114120

115121
virtual ~ActionCache() = default;
116122

llvm/lib/CAS/ActionCache.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ CacheKey::CacheKey(const ObjectProxy &Proxy)
2121
CacheKey::CacheKey(const ObjectStore &CAS, const ObjectRef &Ref)
2222
: Key(toStringRef(CAS.getID(Ref).getHash())) {}
2323

24+
#ifndef _MSC_VER
25+
/// FIXME: MSVC doesn't compile Error within Promise/Future correctly and will
26+
/// result in unchecked error. Disable AsyncAPIs when using MSVC for now.
2427
std::future<AsyncCASIDValue> ActionCache::getFuture(const CacheKey &ActionKey,
2528
bool Globally) const {
2629
std::promise<AsyncCASIDValue> Promise;
@@ -44,6 +47,7 @@ std::future<AsyncErrorValue> ActionCache::putFuture(const CacheKey &ActionKey,
4447
});
4548
return Future;
4649
}
50+
#endif
4751

4852
void ActionCache::getImplAsync(
4953
ArrayRef<uint8_t> ResolvedKey, bool Globally,

llvm/unittests/CAS/ActionCacheTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ TEST(OnDiskActionCache, ActionCacheResultInvalid) {
109109
}
110110
#endif
111111

112+
#ifndef _MSC_VER
113+
/// FIXME: MSVC doesn't compile Error within Promise/Future correctly and will
114+
/// result in unchecked error. Disable AsyncAPIs when using MSVC for now.
112115
TEST_P(CASTest, ActionCacheAsync) {
113116
std::shared_ptr<ObjectStore> CAS = createObjectStore();
114117
std::shared_ptr<ActionCache> Cache = createActionCache();
@@ -150,3 +153,4 @@ TEST_P(CASTest, ActionCacheAsync) {
150153
ASSERT_TRUE(ResultID);
151154
}
152155
}
156+
#endif

llvm/unittests/CAS/CASTestConfig.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ INSTANTIATE_TEST_SUITE_P(InMemoryCAS, CASTest,
4545
::testing::Values(createInMemory));
4646

4747
#if LLVM_ENABLE_ONDISK_CAS
48+
#ifndef _WIN32
4849
__attribute__((constructor)) static void configureCASTestEnv() {
4950
// Restrict the size of the on-disk CAS for tests. This allows testing in
5051
// constrained environments (e.g. small TMPDIR). It also prevents leaving
@@ -57,6 +58,7 @@ __attribute__((constructor)) static void configureCASTestEnv() {
5758
setenv("LLVM_CAS_MAX_MAPPING_SIZE", LimitStr.c_str(), /*overwrite=*/false);
5859
});
5960
}
61+
#endif
6062

6163
TestingAndDir createOnDisk(int I) {
6264
unittest::TempDir Temp("on-disk-cas", /*Unique=*/true);

llvm/unittests/CAS/ObjectStoreTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,14 @@ TEST_P(CASTest, BlobsParallel) {
352352
ASSERT_NO_FATAL_FAILURE(testBlobsParallel1(*CAS, Size));
353353
}
354354

355+
#ifdef EXPENSIVE_CHECKS
355356
TEST_P(CASTest, BlobsBigParallel) {
356357
std::shared_ptr<ObjectStore> CAS = createObjectStore();
357358
// 100k is large enough to be standalone files in our on-disk cas.
358359
uint64_t Size = 100ULL * 1024;
359360
ASSERT_NO_FATAL_FAILURE(testBlobsParallel1(*CAS, Size));
360361
}
362+
#endif
361363

362364
#if LLVM_ENABLE_ONDISK_CAS
363365
TEST(OnDiskCASTest, BlobsParallelMultiCAS) {

0 commit comments

Comments
 (0)