This is an automated email from the ASF dual-hosted git repository. leginee pushed a commit to branch bazel-migration in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 7c234d91b455de4b1928ef31004ad884a72af17c Author: Peter Kovacs <[email protected]> AuthorDate: Sat Jun 20 23:49:09 2026 +0200 comphelper, sax and sal test added --- CLAUDE.md | 12 ++++---- main/comphelper/BUILD.bazel | 73 +++++++++++++++++++++++++++++++++++++++++++++ main/sal/BUILD.bazel | 4 ++- main/sax/BUILD.bazel | 41 +++++++++++++++++++++++++ main/test/readme.md | 12 ++++++++ 5 files changed, 136 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7d77586d32..e2d4833b5f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,11 +14,13 @@ test 🔨 C++ unit-test infra runnable — NOW THE FRONT-LINE TASK: br build/rules/gtest_test.bzl (svidl_bundle analog: stages /MD exe + DLLs + CRT + external manifest into one dir or R6034); libtest (test.dll) builds. GREEN: o3tl_test (5), tools_pathutils, - //main/sal:sal_tests (22) via sal_qa_test macro. See - main/test/readme.md. NEXT: sweep qa/ across the other migrated - modules (comphelper, tools, svl, sax, …); OfficeConnection (UNO - subsequent) tests need a running-soffice fixture; cppunit suites - need Phase-4 dep. + //main/sal:sal_tests (22) via sal_qa_test macro, salhelper_test, + comphelper_test_string + comphelper_test_weakbag, sax_test_converter. + See main/test/readme.md. NEXT: sweep qa/ across the other migrated + modules (svl, svtools, …; svl/qa/test_URIHelper bootstraps a UNO + component context → subsequent test, needs the soffice fixture, not + standalone); OfficeConnection (UNO subsequent) tests need a + running-soffice fixture; cppunit suites need Phase-4 dep. testtools ⬜ (bridgetest — pure-C++ UNO bridge round-trip; cli/pyuno/java variants need rules_java — see Java bucket) qadevOOo ⬜ (Java-based QA test framework; needs rules_java — see Java bucket) diff --git a/main/comphelper/BUILD.bazel b/main/comphelper/BUILD.bazel index b4546153f5..9c133bb3a4 100644 --- a/main/comphelper/BUILD.bazel +++ b/main/comphelper/BUILD.bazel @@ -1,6 +1,7 @@ package(default_visibility = ["//visibility:public"]) load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") +load("//build/rules:gtest_test.bzl", "gtest_test") _DEFINES = [ "WNT", "GUI", "WIN32", @@ -193,5 +194,77 @@ filegroup( visibility = ["//visibility:public"], ) +# ── qa unit tests ───────────────────────────────────────────────── +# Standalone GoogleTest exes (own main()). Both #include +# precompiled_comphelper.hxx (inc/pch) and link comphelp.dll's import lib; +# comphelpMSC.dll + its transitive runtime DLLs must sit beside the exe. +_QA_COPTS = [ + "/Imain/comphelper/inc/pch", + "/Zc:wchar_t-", + "/D_HAS_ITERATOR_DEBUGGING=0", +] + +_QA_RUNTIME_DLLS = [ + "//main/sal:sal3", + "//main/cppu:cppu3", + "//main/cppuhelper:cppuhelper3MSC", + "//main/salhelper:salhelper3MSC", + "//main/ucbhelper:ucbhelperMSC", + "//main/vos:vos3MSC", + ":comphelpMSC", +] + +_QA_LINKER_INPUTS = [ + "//main/sal:sal_implib", + "//main/cppu:cppu3_implib", + "//main/cppuhelper:cppuhelper_implib", + ":comphelpMSC_implib", +] + +_QA_LINKOPTS = [ + "$(execpath //main/sal:sal_implib)", + "$(execpath //main/cppu:cppu3_implib)", + "$(execpath //main/cppuhelper:cppuhelper_implib)", + "$(execpath :comphelpMSC_implib)", +] + +# comphelper::string::searchAndReplaceAsciiI round-trip (qa/test_string.cxx). +gtest_test( + name = "comphelper_test_string", + srcs = ["qa/test_string.cxx"], + copts = _QA_COPTS, + defines = _DEFINES, + deps = [ + ":comphelper_headers", + "//main/sal:sal_headers", + "//main/cppu:cppu_headers", + "//main/cppuhelper:cppuhelper_headers", + "//main/stlport:stlport", + "@boost.legacy//:boost.legacy", + ], + additional_linker_inputs = _QA_LINKER_INPUTS, + linkopts = _QA_LINKOPTS, + runtime_dlls = _QA_RUNTIME_DLLS, +) + +# comphelper::WeakBag lifetime semantics (qa/test_weakbag.cxx). +gtest_test( + name = "comphelper_test_weakbag", + srcs = ["qa/test_weakbag.cxx"], + copts = _QA_COPTS, + defines = _DEFINES, + deps = [ + ":comphelper_headers", + "//main/sal:sal_headers", + "//main/cppu:cppu_headers", + "//main/cppuhelper:cppuhelper_headers", + "//main/stlport:stlport", + "@boost.legacy//:boost.legacy", + ], + additional_linker_inputs = _QA_LINKER_INPUTS, + linkopts = _QA_LINKOPTS, + runtime_dlls = _QA_RUNTIME_DLLS, +) + exports_files(glob(["**/*.component"])) diff --git a/main/sal/BUILD.bazel b/main/sal/BUILD.bazel index 323661c965..1e4582ba26 100644 --- a/main/sal/BUILD.bazel +++ b/main/sal/BUILD.bazel @@ -240,7 +240,9 @@ sal_qa_test(name = "test-setthreadname", srcs = ["qa/osl/setthreadname/test-sett sal_qa_test(name = "osl_Security", srcs = ["qa/osl/security/osl_Security.cxx"], subdir = "osl/security", copts = ["/FIwindows.h"], linkopts = ["advapi32.lib"]) sal_qa_test(name = "osl_Module", srcs = ["qa/osl/module/osl_Module.cxx"], subdir = "osl/module") sal_qa_test(name = "sal_ut_osl_pipe", srcs = ["qa/osl/pipe/osl_Pipe.cxx"], subdir = "osl/pipe") -sal_qa_test(name = "osl_File", srcs = ["qa/osl/file/osl_File.cxx"], subdir = "osl/file") +# osl_File uses Win32 directly (MAX_PATH/DWORD, GetLogicalDrives/GetFileAttributes +# — all kernel32, default-linked): force-include <windows.h> like osl_Security. +sal_qa_test(name = "osl_File", srcs = ["qa/osl/file/osl_File.cxx"], subdir = "osl/file", copts = ["/FIwindows.h"]) sal_qa_test(name = "tcwf", srcs = ["qa/osl/file/test_cpy_wrt_file.cxx"], subdir = "osl/file") sal_qa_test(name = "osl_old_test_file", srcs = ["qa/osl/file/osl_old_test_file.cxx"], subdir = "osl/file") sal_qa_test(name = "osl_Thread", srcs = ["qa/osl/process/osl_Thread.cxx"], subdir = "osl/process") diff --git a/main/sax/BUILD.bazel b/main/sax/BUILD.bazel index 71826ea2c0..ac7ae9a871 100644 --- a/main/sax/BUILD.bazel +++ b/main/sax/BUILD.bazel @@ -1,6 +1,7 @@ package(default_visibility = ["//visibility:public"]) load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") +load("//build/rules:gtest_test.bzl", "gtest_test") _DEFINES = [ "WNT", "GUI", "WIN32", @@ -152,5 +153,45 @@ cc_binary( visibility = ["//visibility:public"], ) +# ── qa unit test ────────────────────────────────────────────────── +# sax::Converter round-trips (qa/gtest/test_converter.cxx). Standalone +# GoogleTest (own main()); links sax.dll's import lib, so sax.dll + its +# transitive runtime DLLs (comphelp pulls salhelper/ucbhelper/vos) must sit +# beside the exe. preextstl.h/postextstl.h come from stlport/systemstlguards. +gtest_test( + name = "sax_test_converter", + srcs = ["qa/gtest/test_converter.cxx"], + copts = [ + "/Imain/sax/inc", + "/Imain/stlport/systemstlguards", + "/Zc:wchar_t-", + ], + defines = _DEFINES, + deps = _COMMON_DEPS + [ + ":sax_headers", + "@boost.legacy//:boost.legacy", + ], + additional_linker_inputs = [ + "//main/sal:sal_implib", + "//main/cppu:cppu3_implib", + ":sax_implib", + ], + linkopts = [ + "$(execpath //main/sal:sal_implib)", + "$(execpath //main/cppu:cppu3_implib)", + "$(execpath :sax_implib)", + ], + runtime_dlls = [ + "//main/sal:sal3", + "//main/cppu:cppu3", + "//main/cppuhelper:cppuhelper3MSC", + "//main/comphelper:comphelpMSC", + "//main/salhelper:salhelper3MSC", + "//main/ucbhelper:ucbhelperMSC", + "//main/vos:vos3MSC", + ":sax", + ], +) + exports_files(glob(["**/*.component"])) diff --git a/main/test/readme.md b/main/test/readme.md index 243a03393a..732cfffdbc 100644 --- a/main/test/readme.md +++ b/main/test/readme.md @@ -20,6 +20,18 @@ holdouts). This brings the test layer onto Bazel so suites run under - `//main/o3tl:o3tl_test` - `//main/tools:tools_pathutils` - `//main/sal:sal_tests` (green gate, 22 targets) + - `//main/salhelper:salhelper_test` + - `//main/comphelper:comphelper_test_string`, `:comphelper_test_weakbag` + - `//main/sax:sax_test_converter` + + For a test that links a module DLL (not just sal), the staged exe needs + that DLL **and its transitive runtime DLLs** co-located (the loader only + searches the exe's dir). comphelp.dll, e.g., drags in + sal3/cppu3/cppuhelper3MSC/salhelper3MSC/ucbhelperMSC/vos3MSC — list them all + in `runtime_dlls`. Link-time `additional_linker_inputs` must include the + import lib of every DLL whose symbols the test TU references directly + (e.g. `cppu3_implib` for `uno_any_destruct`/`typelib_*` pulled in by an + `Any` destructor or `getCppuType`). 2. **Subsequent / UNO tests** — use `test::OfficeConnection` to launch a real soffice. Need the staged install wired as a fixture. **Not yet wired.**
