Skip to content

Enable osign gtest suite under CTest - #134

Open
Hathor875 wants to merge 2 commits into
Euro-Office:mainfrom
Hathor875:feat/osign-cmake-ctest
Open

Enable osign gtest suite under CTest#134
Hathor875 wants to merge 2 commits into
Euro-Office:mainfrom
Hathor875:feat/osign-cmake-ctest

Conversation

@Hathor875

@Hathor875 Hathor875 commented Aug 23, 2026

Copy link
Copy Markdown

Part of #93
Port the osign library from qmake to CMake and register its GoogleTest suite with CTest. This was the last un-migrated gtest suite in the list tracked by issue #93, blocked only by the missing osign build target.

The suite needs no fixtures — it generates its own passwords and certificates at run time — so the target needs neither staged data nor a custom WORKING_DIRECTORY.

Notes on the translation of osign.pro:

  • common_openssl.cpp is compiled into the library. osign.pro pulls it in through "CONFIG += open_ssl_common" (openssl.pri) and certificate.cpp calls NSOpenSSL::PBKDF2 and AES_*_desktop_GCM, so the test executable does not link without it.
  • Base64.cpp and File.cpp are deliberately not compiled in. The .pro compiled them directly because qmake did not link kernel; the CMake target links kernel, which already provides NSBase64 and NSFile.
  • KERNEL_USE_DYNAMIC_LIBRARY_BUILDING is not carried over. In the .pro it only served to export those two files from osign; the target now wants KERNEL_DECL = Q_DECL_IMPORT.
  • src/Certificate_openssl.h and the support_oform block are dropped — neither header exists under osign/lib/src and no source includes them.
  • The core_windows link list is ported verbatim but is untested here, as the port was developed and verified on Linux.

Unlike ooxmlsignature — which x2tlib pulls into the default build — osign has no non-test consumer, so it is reached only through the test's guarded add_subdirectory, and nothing changes when EO_BUILD_TESTS is OFF.

Verified locally: osign_test builds from a clean target directory and reports 6/6 passing; the seven other built CTest suites still pass alongside it.
Built on Fedora, which needs two local deviations from TESTING.md (not part of this PR): libstdc++-static installed, and third-party deps built beforehand so -DTHIRD_PARTY_PREPARED=TRUE can skip the V8 step, which needs clang-13. osign does not depend on V8.

Assisted-by: Claude Code:claude-opus-5

Tests

$ cd ~/euro/core && export VCPKG_ROOT=/var/home/krzysztofc/vcpkg && \
  cmake -GNinja -S . -B build \
    -DTHIRD_PARTY_PREPARED=TRUE \
    -DVCPKG_TARGET_TRIPLET=x64-linux-dynamic \
    -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
    -DVCPKG_MANIFEST_MODE=ON -DVCPKG_MANIFEST_DIR=. \
    -DVCPKG_MANIFEST_FEATURES=tests -DEO_BUILD_TESTS=ON && \
  rm -rf build/osign_test build/package/libosign.so.1 && \
  cmake --build build --target osign_test && \
  ctest --test-dir ~/euro/core/build -R osign_test -V

[... vcpkg install + cmake configure trimmed ...]
-- Configuring done (24.8s)
-- Generating done (0.2s)
-- Build files have been written to: /var/home/krzysztofc/euro/core/build

[5/12] Building CXX object osign_test/osign/CMakeFiles/osign.dir/src/certificate.cpp.o
certificate.cpp:153:39: warning: suggest parentheses around comparison in operand of '=='
  153 |  if (1 != ASN1_STRING_set(serialNumber, pSerialNumber, nBytesCount) == 1)
[... two -Wunused-value warnings from OpenSSL's BIO_flush macro trimmed ...]
[7/12] Creating library symlink osign_test/osign/libosign.so
🎉  Success! [libosign.so.1] is ready!  🎉
[9/12] Linking CXX executable osign_test/osign_test

9: Test command: /var/home/krzysztofc/euro/core/build/osign_test/osign_test
9: Working Directory: /var/home/krzysztofc/euro/core/build/osign_test
9:  LD_LIBRARY_PATH=/var/home/krzysztofc/euro/core/build/package:/var/home/krzysztofc/euro/core/build/vcpkg_installed/x64-linux-dynamic/lib:
9: [==========] Running 6 tests from 1 test suite.
9: [       OK ] COSignTest.crypt_storage_aes_gcm_random_password (1 ms)
9: [       OK ] COSignTest.crypt_storage_aes_gcm_string_password (0 ms)
9: [       OK ] COSignTest.serialize_buffer_string (0 ms)
9: [       OK ] COSignTest.sign_buffer_string (0 ms)
9: [       OK ] COSignTest.serialize_storage_by_sign (0 ms)
9: [       OK ] COSignTest.serialize_storage_by_property (0 ms)
9: [  PASSED  ] 6 tests.
1/1 Test #9: osign_test .......................   Passed    0.02 sec

100% tests passed, 0 tests failed out of 1

The -Wparentheses warning above is pre-existing and cosmetic: certificate.cpp:153
reads if (1 != ASN1_STRING_set(...) == 1), which parses as (1 != ...) == 1 and is
therefore true exactly when the call fails, so the fallback behaves as intended.
Not touched here.

No regressions in the suites already migrated:

$ ctest --test-dir ~/euro/core/build -E test_odf
Test project /var/home/krzysztofc/euro/core/build
1/8 Test #1: cfcpp_test .......................   Passed    0.15 sec
2/8 Test #2: booleanoperations_test ...........   Passed    0.01 sec
3/8 Test #3: starmath_smconverter_test ........   Passed    0.01 sec
4/8 Test #4: starmath_eqntoooxml_test .........   Passed    0.00 sec
5/8 Test #5: ooxml_test .......................***Not Run   0.00 sec
6/8 Test #6: officeutils_test .................   Passed    0.01 sec
7/8 Test #7: starmath_smcustomshape_test ......   Passed    0.00 sec
8/8 Test #8: osign_test .......................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 7

ooxml_test and test_odf were not built in this tree, hence the "Not Run" and the
exclusion — ooxml_test is additionally marked DISABLED in the repo. Everything that
was built passes.

Port the osign library from qmake to CMake and register its GoogleTest
suite with CTest. This was the last un-migrated gtest suite in the list
tracked by issue Euro-Office#93, blocked only by the missing osign build target.

The suite needs no fixtures — it generates its own passwords and
certificates at run time — so the target needs neither staged data nor a
custom WORKING_DIRECTORY.

Notes on the translation of osign.pro:

- common_openssl.cpp is compiled into the library. osign.pro pulls it in
  through "CONFIG += open_ssl_common" (openssl.pri) and certificate.cpp
  calls NSOpenSSL::PBKDF2 and AES_*_desktop_GCM, so the test executable
  does not link without it.
- Base64.cpp and File.cpp are deliberately not compiled in. The .pro
  compiled them directly because qmake did not link kernel; the CMake
  target links kernel, which already provides NSBase64 and NSFile.
- KERNEL_USE_DYNAMIC_LIBRARY_BUILDING is not carried over. In the .pro it
  only served to export those two files from osign; the target now wants
  KERNEL_DECL = Q_DECL_IMPORT.
- src/Certificate_openssl.h and the support_oform block are dropped —
  neither header exists under osign/lib/src and no source includes them.
- The core_windows link list is ported verbatim but is untested here, as
  the port was developed and verified on Linux.

Like ooxmlsignature, the library is not added to the default build; it is
reached only through the test's guarded add_subdirectory, so nothing
changes when EO_BUILD_TESTS is OFF.

Verified locally: osign_test builds from a clean target directory and
reports 6/6 passing; the seven other built CTest suites still pass
alongside it.

Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Krzysztof Cieślik <132496025+Hathor875@users.noreply.github.com>
@Hathor875
Hathor875 requested a review from a team as a code owner August 23, 2026 00:53
@Hathor875
Hathor875 requested review from Aiiaiiio and chrip and removed request for a team August 23, 2026 00:53

@chrip chrip left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engineering is correct and I could not fault a single translation decision;
the only substantive finding is a one-line factual error that would otherwise be baked into
repo documentation. Two things before merge:

1. Reword the ooxmlsignature comparison in TESTING.md. The new block currently ends:

Like ooxmlsignature, the library is not part of the default build: it is reached only
through the test's guarded add_subdirectory.

ooxmlsignature is in the default build — CMakeLists.txt:22
X2tConverter/build/cmake/CMakeLists.txt:11
X2tConverter/build/cmake/library/CMakeLists.txt:124-126, where x2tlib adds
DesktopEditor/xmlsec/src with no EO_BUILD_TESTS gate. Keeping osign test-only is still the
right call — nothing in x2tlib or the DocumentServer packaging references it — so only the
comparison is wrong. Suggested replacement:

Unlike ooxmlsignature — which x2tlib pulls into the default build — osign has no
non-test consumer, so it is reached only through the test's guarded add_subdirectory
and nothing changes when EO_BUILD_TESTS is OFF.

The same sentence appears in the PR description and the commit message; worth fixing there too,
but TESTING.md is the copy that becomes permanent repo documentation.

2. CI approval — on me, not you. Nothing beyond the DCO check has run: the Build, Build
(Windows x64) and Build WASM runs are all sitting in action_required. As a first-time
contributor with read access pushing from a fork, you cannot release them yourself, so there is
nothing for you to do here — I'll approve the runs so the Linux job actually compiles osign
and executes osign_test.

With the reword in and a green Linux build, this is a straightforward approve. Nice, careful
piece of work otherwise — every translation decision in the description held up when I checked
it against the sources.

Assisted-by: ClaudeCode:claude-opus-5

@Hathor875

Copy link
Copy Markdown
Author

Thanks for catching that. Will verify the x2tlib chain and fix the wording in TESTING.md, the commit message and the PR description.

Understood on CI.

The osign entry claimed ooxmlsignature is not part of the default build. It is:
CMakeLists.txt:22 adds x2t, X2tConverter/build/cmake/CMakeLists.txt:11 adds
x2tlib, and X2tConverter/build/cmake/library/CMakeLists.txt:123-125 pulls in
DesktopEditor/xmlsec/src with no EO_BUILD_TESTS gate.

Keeping osign test-only is still correct — nothing outside the test references
it — so only the comparison was wrong. Reworded to say what actually
distinguishes the two.

Reported in review by @chrip on Euro-Office#134.

Signed-off-by: Krzysztof Cieślik <132496025+Hathor875@users.noreply.github.com>
Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Hathor875

Copy link
Copy Markdown
Author

@chrip
Fixed in d6a1ae0 .

Two notes on CI:

  • Windows fails during configure while fetching V8 via depot_tools, before anything compiles — same failure as on several unrelated branches. osign does not depend on V8.
  • Linux was cancelled at the 6h job limit, not failed, so it never got to build osign or run osign_test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants