%global debug_package %{nil} %global crate test_scenarios_rust Name: testing-utils Version: 0.2.3 Release: 1%{?dist} Summary: Test framework tools and helpers for performance stack project License: MIT URL: https://github.com/example/testing-utils Source0: %{name}-%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: make BuildRequires: rust-packaging >= 21 BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: gtest-devel BuildRequires: score-baselibs-devel # For running tests %if 0%{?with_check} BuildRequires: python3-pytest %endif %description Test framework tools and helpers for performance stack project. This repository provides utilities to assist with test automation, log handling, and result parsing. It is designed to be a set of helper libraries for test frameworks or custom test runners. Features: - Test scenarios libraries: Rust and C++ libraries for implementing test scenarios - Build tools: Utilities for interacting with Bazel and Cargo - Log container: A container for storing and querying logs - ResultEntry and subclasses: Structured representation of test log entries - Scenario: Utilities for defining and running test scenarios %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: gtest-devel # Note: score-baselibs-devel is an optional runtime dependency # Users who want tracing functionality should install it separately %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package -n python3-%{name} Summary: Python 3 module for %{name} Requires: python3 Requires: python3-pytest %description -n python3-%{name} The python3-%{name} package contains the Python 3 module for %{name}. %package -n rust-test_scenarios_rust+default-devel Summary: Rust test_scenarios_rust crate BuildArch: noarch %description -n rust-test_scenarios_rust+default-devel The rust-test_scenarios_rust+default-devel package contains the Rust test_scenarios_rust crate. %prep %autosetup -n testing_tools cd test_scenarios_rust %cargo_prep cd .. %generate_buildrequires cd test_scenarios_rust %cargo_generate_buildrequires cd .. %build # Build C++ components with PIE support export CXXFLAGS="%{build_cxxflags} -fPIE" # Clean any existing build artifacts to ensure rebuild with PIE make clean make cpp # Build Rust components using cargo macros cd test_scenarios_rust %cargo_build cd .. # Build Python components - no build needed for pure Python %install # Install C++ and Rust components using our Makefile make install DESTDIR=%{buildroot} PREFIX=%{_prefix} PYTHON_INSTALL=no # Install Python package manually mkdir -p %{buildroot}%{python3_sitelib} cp -r testing_utils %{buildroot}%{python3_sitelib}/ # Install coverage checker script install -d %{buildroot}%{_bindir} install -m 755 scripts/coverage_checker/coverage_checker.py %{buildroot}%{_bindir}/coverage_checker # Install Rust crate using cargo macros with --allow-dirty cd test_scenarios_rust set -euo pipefail CRATE_NAME=$(cargo2rpm --path Cargo.toml name) CRATE_VERSION=$(cargo2rpm --path Cargo.toml version) REG_DIR=%{buildroot}%{crate_instdir} mkdir -p $REG_DIR # Backup original Cargo.toml before modifying for packaging cp Cargo.toml ../Cargo.toml.backup awk -i inplace -v INPLACE_SUFFIX=.deps '/^\[((.+\.)?((dev|build)-)?dependencies|features)/{f=1;next} /^\[/{f=0}; !f' Cargo.toml # Clean any existing .cargo directory to avoid contamination rm -rf .cargo env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' \ cargo package -l --allow-dirty | \ grep -w -E -v 'Cargo\.(lock|toml\.orig)' | \ grep -v '\.cargo_vcs_info\.json' | \ grep -v '^\.cargo' | \ grep -v '\.cargo/' | \ xargs -d '\n' cp --parents -a -t $REG_DIR # Restore original Cargo.toml for tests mv ../Cargo.toml.backup Cargo.toml cd .. %check # Run C++ tests with PIE support export CXXFLAGS="%{build_cxxflags} -fPIE" export LDFLAGS="%{build_ldflags} -pie" make cpp-test # Run Rust tests cd test_scenarios_rust # Restore .cargo/config.toml for offline testing if [ ! -f .cargo/config.toml ]; then mkdir -p .cargo cat > .cargo/config.toml << 'EOF' [source.crates-io] replace-with = "vendored-sources" [source.vendored-sources] directory = "vendor" EOF fi env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS="%{build_rustflags}" cargo test --lib --bins --offline cd .. # Run Python tests (if any) cd testing_utils && python3 -m pytest . -v || true %files %doc README.md %{_libdir}/libtest_scenarios_cpp.a %{_bindir}/coverage_checker %files devel %{_includedir}/test_scenarios_cpp/ %{_libdir}/rust/libtest_scenarios_rust.rlib %files -n python3-%{name} %{python3_sitelib}/testing_utils/ %files -n rust-test_scenarios_rust+default-devel %{crate_instdir}/ %changelog * Thu Sep 26 2024 Claude AI - 0.2.3-1 - Initial RPM package - Multi-language support (C++, Rust, Python) - Complete test suite integration - Replaced Bazel with Makefile build system