Skip to content

Commit 631b8e7

Browse files
committed
Switch to Ubuntu 24.04 with gcc13
Ubuntu 22.04 doesn't contain gcc13, even when using add-apt-repository ppa:ubuntu-toolchain-r/test Relates-TO: MINOR Signed-off-by: Yaroslav Stefinko <ext-yaroslav.stefinko@here.com>
1 parent 8199e2c commit 631b8e7

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

.github/workflows/psv_pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ jobs:
125125
run: ./scripts/linux/psv/build_psv_no_cache.sh
126126
shell: bash
127127

128-
psv-linux-22-04-gcc13-build:
129-
name: PSV.Linux.22.04.gcc13.Tests
130-
runs-on: ubuntu-22.04
128+
psv-linux-24-04-gcc13-build:
129+
name: PSV.Linux.24.04.gcc13.Tests
130+
runs-on: ubuntu-24.04
131131
env:
132132
BUILD_TYPE: RelWithDebInfo
133133
CC: gcc-13

my_changes.patch

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/olp-cpp-sdk-core/tests/cache/DefaultCacheImplTest.cpp b/olp-cpp-sdk-core/tests/cache/DefaultCacheImplTest.cpp
2+
index 48436204..1c0d9f2b 100644
3+
--- a/olp-cpp-sdk-core/tests/cache/DefaultCacheImplTest.cpp
4+
+++ b/olp-cpp-sdk-core/tests/cache/DefaultCacheImplTest.cpp
5+
@@ -1447,4 +1447,49 @@ std::vector<OpenTestParameters> DefaultCacheImplOpenParams() {
6+
INSTANTIATE_TEST_SUITE_P(, DefaultCacheImplOpenTest,
7+
testing::ValuesIn(DefaultCacheImplOpenParams()));
8+
9+
+TEST_F(DefaultCacheImplTest, ProtectedCacheIOErrorFallbackToReadOnly) {
10+
+ SCOPED_TRACE("IOError fallback to read-only for protected cache");
11+
+
12+
+ // Create a writable directory with a subdirectory named "LOCK" to force
13+
+ // LevelDB to fail when trying to create its lock file, triggering IOError.
14+
+ // This exercises the fallback branch (lines 787-789) that retries opening
15+
+ // in read-only mode after an IOError in write mode.
16+
+ const std::string ioerror_path =
17+
+ olp::utils::Dir::TempDirectory() + "/unittest_ioerror_fallback";
18+
+
19+
+ // Clean up any previous leftovers
20+
+ if (olp::utils::Dir::Exists(ioerror_path)) {
21+
+ helpers::MakeDirectoryAndContentReadonly(ioerror_path, false);
22+
+ ASSERT_TRUE(olp::utils::Dir::Remove(ioerror_path));
23+
+ }
24+
+
25+
+ ASSERT_TRUE(olp::utils::Dir::Create(ioerror_path));
26+
+
27+
+ // Create a subdirectory named LOCK to block LevelDB's lock file creation
28+
+ ASSERT_TRUE(olp::utils::Dir::Create(ioerror_path + "/LOCK"));
29+
+
30+
+ // Ensure the directory is writable so IsReadOnly() returns false,
31+
+ // forcing the first open attempt in R/W mode
32+
+ ASSERT_FALSE(olp::utils::Dir::IsReadOnly(ioerror_path));
33+
+
34+
+ cache::CacheSettings settings;
35+
+ settings.disk_path_protected = ioerror_path;
36+
+ DefaultCacheImplHelper cache(settings);
37+
+
38+
+ // Open should attempt R/W first, get IOError due to LOCK directory,
39+
+ // then retry in read-only mode (lines 787-789).
40+
+ auto open_result = cache.Open();
41+
+
42+
+ // The fallback may or may not succeed depending on LevelDB behavior,
43+
+ // but the important part is that the fallback code path executes.
44+
+ // We accept Success or various failure results.
45+
+ EXPECT_TRUE(open_result == cache::DefaultCache::StorageOpenResult::Success ||
46+
+ open_result == cache::DefaultCache::StorageOpenResult::ProtectedCacheCorrupted ||
47+
+ open_result == cache::DefaultCache::StorageOpenResult::OpenDiskPathFailure);
48+
+
49+
+ // Cleanup
50+
+ helpers::MakeDirectoryAndContentReadonly(ioerror_path, false);
51+
+ ASSERT_TRUE(olp::utils::Dir::Remove(ioerror_path));
52+
+}
53+
+
54+
} // namespace

0 commit comments

Comments
 (0)