Skip to content

Commit

Permalink
Merge pull request #830 from openzim/latest-gtest-support
Browse files Browse the repository at this point in the history
Add support to recent googletest framework
  • Loading branch information
kelson42 authored Nov 2, 2023
2 parents e3316a4 + 419b06f commit 2a810ac
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
HOME: /home/runner
runs-on: ubuntu-22.04
container:
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:38"
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2023-10-30"

steps:
- name: Install dependences
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
distro:
- debian-unstable
- debian-bullseye
- debian-buster
- ubuntu-jammy
- ubuntu-focal
steps:
Expand Down Expand Up @@ -56,13 +55,6 @@ jobs:
with:
args: --no-sign

- uses: legoktm/gh-action-build-deb@debian-buster
if: matrix.distro == 'debian-buster'
name: Build package for debian-buster
id: build-debian-buster
with:
args: --no-sign

- uses: legoktm/gh-action-build-deb@ubuntu-jammy
if: matrix.distro == 'ubuntu-jammy'
name: Build package for ubuntu-jammy
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ else
icu_dep = dependency('icu-i18n', required:false, static:static_linkage)
endif

gtest_dep = dependency('gtest', main:true, fallback:['gtest', 'gtest_main_dep'], required:false)
gtest_dep = dependency('gtest', version: '>=1.10.0', main:true, fallback:['gtest', 'gtest_main_dep'], required:false)

inc = include_directories('include')

Expand Down
22 changes: 14 additions & 8 deletions subprojects/gtest.wrap
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
[wrap-file]
directory = googletest-release-1.8.1
directory = googletest-1.14.0
source_url = https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz
source_filename = gtest-1.14.0.tar.gz
source_hash = 8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7
patch_filename = gtest_1.14.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.14.0-1/get_patch
patch_hash = 2e693c7d3f9370a7aa6dac802bada0874d3198ad4cfdf75647b818f691182b50
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.14.0-1/gtest-1.14.0.tar.gz
wrapdb_version = 1.14.0-1

source_url = https://github.com/google/googletest/archive/release-1.8.1.zip
source_filename = gtest-1.8.1.zip
source_hash = 927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7

patch_url = https://wrapdb.mesonbuild.com/v1/projects/gtest/1.8.1/1/get_zip
patch_filename = gtest-1.8.1-1-wrap.zip
patch_hash = f79f5fd46e09507b3f2e09a51ea6eb20020effe543335f5aee59f30cc8d15805
[provide]
gtest = gtest_dep
gtest_main = gtest_main_dep
gmock = gmock_dep
gmock_main = gmock_main_dep
2 changes: 1 addition & 1 deletion test/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using CompressionAlgo = ::testing::Types<
ZSTD_INFO
>;

TYPED_TEST_CASE(CompressionTest, CompressionAlgo);
TYPED_TEST_SUITE(CompressionTest, CompressionAlgo);

TYPED_TEST(CompressionTest, compress) {
std::string data;
Expand Down
2 changes: 1 addition & 1 deletion test/decoderstreamreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ using CompressionTypes = ::testing::Types<
ZSTD_INFO
>;

TYPED_TEST_CASE(DecoderStreamReaderTest, CompressionTypes);
TYPED_TEST_SUITE(DecoderStreamReaderTest, CompressionTypes);

TYPED_TEST(DecoderStreamReaderTest, justCompressedData) {
typedef typename TestFixture::CompressionInfo CompressionInfo;
Expand Down
12 changes: 6 additions & 6 deletions test/error_in_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ TEST_P(FaultyItemErrorTest, faultyItem)

// It would be more natural to put the `#if defined` only around the
// discarded values, but when crosscompiling on Windows, compiler fail to
// understand ``#if defined` when used inside the `INSTANTIATE_TEST_CASE_P`
// understand ``#if defined` when used inside the `INSTANTIATE_TEST_SUITE_P`
// macro. I suspect some macro definition conflicts.
#if defined(ENABLE_XAPIAN)
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
CreatorError,
FaultyItemErrorTest,
::testing::Values(
Expand All @@ -200,7 +200,7 @@ ::testing::Values(
ERRORKIND::GET_INDEXDATA
));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
CreatorError,
FaultyItemErrorTest,
::testing::Values(
Expand Down Expand Up @@ -354,10 +354,10 @@ TEST_P(FaultyDelayedItemErrorTest, faultyUnfinishedCreator)
}
// It would be more natural to put the `#if defined` only around the
// discarded values, but when crosscompiling on Windows, compiler fail to
// understand ``#if defined` when used inside the `INSTANTIATE_TEST_CASE_P`
// understand ``#if defined` when used inside the `INSTANTIATE_TEST_SUITE_P`
// macro. I suspect some macro definition conflicts.
#if defined(ENABLE_XAPIAN)
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
CreatorError,
FaultyDelayedItemErrorTest,
::testing::Values(
Expand All @@ -372,7 +372,7 @@ ::testing::Values(
ERRORKIND::GET_INDEXDATA_POSITION
));
#else
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
CreatorError,
FaultyDelayedItemErrorTest,
::testing::Values(
Expand Down

0 comments on commit 2a810ac

Please sign in to comment.